uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Product:
Class:
Programmatically assigns the value of one variable to another, bypassing the expression evaluator for high performance.
This method does not return a value.
This method provides a direct, programmatic way to assign the value of one uCalc Item (typically a variable) to another. It operates on the underlying data, effectively performing an assignment like destination = source at the native level.
This method is a high-performance alternative to other forms of assignment within uCalc.
vs. uc.Eval("destination = source")Using the Eval function requires the engine to parse the string, look up both symbols, and then perform the assignment. destination.Value(source) skips the parsing and lookup steps entirely, making it significantly faster. It is the ideal choice when you are manipulating variables from your host application code (C#, C++, etc.) and performance is critical.
vs. destination.Value(source.Value())Manually getting the scalar value from the source and setting it on the destination works, but it involves an intermediary step in your host language. destination.Value(source) is more direct, as it allows the uCalc engine to perform an optimized internal copy, which can be more efficient and better handle complex or custom data types.
The assignment will attempt to perform a safe type conversion if the source and destination variables have different data types. For example, assigning a Double to an Int will result in the value being truncated, similar to a static cast in C++ or an explicit cast in C#.