Sets the value of a uCalc variable to a specified 64-bit integer.
Product:
Class:
Warning
uCalc API Preview Release Notice:The uCalc engine has successfully transitioned to modern cross-platform environments.The next phase envolves some structural changes, performance optimizations, and API refinements.The API is subject to breaking changes prior to the stable release. Please evaluate the preview version thoroughly before production use.
This method does not return a value.
The ValueInt64 method provides a direct and type-safe way to set the value of a uCalc variable that holds a 64-bit integer. It is the primary setter for variables defined as Int64 or Long.
This method is used after a variable has been created with a method like DefineVariable. It allows the host application to update the variable's state before an expression is evaluated, which is crucial for performance.
using uCalcSoftware;
var uc = new uCalc();
// 1. Define a 64-bit integer variable for a database record ID
var recordId = uc.DefineVariable("recordId As Int64");
// 2. Set its value using ValueInt64
recordId.ValueInt64(8192837123981273);
// 3. Use it in an expression
Console.WriteLine(uc.EvalStr("recordId")); // Outputs: 8192837123981273
This method handles both signed (Int64) and unsigned (Int64u) variables correctly. When setting an unsigned variable, the bit pattern is preserved. For example, setting an Int64u variable to -1 will result in its maximum possible value, 18446744073709551615.
There are three primary ways to manage variable values in uCalc, each with different performance characteristics.
ValueInt64 (Type-Safe Setter - Recommended)
Value(string) (Expression-Based Setter)
Direct Memory Binding (Highest Performance)
DefineVariable, you can pass a pointer to a host application variable. The uCalc variable becomes a direct proxy to your native variable, eliminating the need for any setter calls.In summary, ValueInt64 offers the best balance of performance, safety, and ease of use for programmatically updating 64-bit integer variables.
This page last modified on: