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:
Dynamically enables or disables a behavioral property for a uCalc item, such as making it read-only or toggling its active state.
Returns the current Item object to allow for a fluent interface and method chaining.
The IsProperty method acts as a setter for the boolean flags that control an Item's behavior. It allows you to dynamically modify an item's characteristics at runtime after it has been defined.
This is the setter overload; for checking a property's status, see the getter overload: IsProperty(ItemIs).
Properties are like switches that can be turned on (true) or off (false). By setting a property, you can alter how uCalc treats an item during parsing, evaluation, or transformation.
ItemIs::Locked property. This is a more programmatic way to achieve what DefineConstant() does.Transformer rule by toggling its ItemIs::Active property.ItemIs::CaseSensitive or ItemIs::RewindOnChange.This method returns the Item object itself, which allows for a fluent interface or method chaining. You can define an item and immediately set a property on it in a single, readable line of code.
csharp
// Define a variable and immediately lock it
var pi = uc.DefineVariable("pi = 3.14159").IsProperty(ItemIs.Locked, true);
In statically-typed languages like C#, an object's behavior is often fixed at compile time (e.g., using the readonly keyword). While reflection can be used to modify properties, it is often complex and slow.
In dynamic languages like Python, you can change object attributes freely (my_obj.is_active = False), but this lacks the structured, enumerated property system of uCalc.
uCalc's IsProperty method provides the best of both worlds: the flexibility of a dynamic language with the clarity and safety of an enumerated property system (ItemIs), all accessible at runtime.
ID: 101
using uCalcSoftware;
var uc = new uCalc();
var MyVar = uc.DefineVariable("x = 100");
Console.WriteLine(uc.EvalStr("x"));
uc.EvalStr("x = 200");
Console.WriteLine(uc.EvalStr("x")); // x can change here
// Locking an item prevents it from being changed
MyVar.IsProperty(ItemIs.Locked, true);
uc.EvalStr("x = 300"); // x cannot change here
Console.WriteLine(uc.EvalStr("x")); // x retains the previous value
100
200
200 using uCalcSoftware; var uc = new uCalc(); var MyVar = uc.DefineVariable("x = 100"); Console.WriteLine(uc.EvalStr("x")); uc.EvalStr("x = 200"); Console.WriteLine(uc.EvalStr("x")); // x can change here // Locking an item prevents it from being changed MyVar.IsProperty(ItemIs.Locked, true); uc.EvalStr("x = 300"); // x cannot change here Console.WriteLine(uc.EvalStr("x")); // x retains the previous value
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto MyVar = uc.DefineVariable("x = 100");
cout << uc.EvalStr("x") << endl;
uc.EvalStr("x = 200");
cout << uc.EvalStr("x") << endl; // x can change here
// Locking an item prevents it from being changed
MyVar.IsProperty(ItemIs::Locked, true);
uc.EvalStr("x = 300"); // x cannot change here
cout << uc.EvalStr("x") << endl; // x retains the previous value
}
100
200
200 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto MyVar = uc.DefineVariable("x = 100"); cout << uc.EvalStr("x") << endl; uc.EvalStr("x = 200"); cout << uc.EvalStr("x") << endl; // x can change here // Locking an item prevents it from being changed MyVar.IsProperty(ItemIs::Locked, true); uc.EvalStr("x = 300"); // x cannot change here cout << uc.EvalStr("x") << endl; // x retains the previous value }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim MyVar = uc.DefineVariable("x = 100")
Console.WriteLine(uc.EvalStr("x"))
uc.EvalStr("x = 200")
Console.WriteLine(uc.EvalStr("x")) '// x can change here
'// Locking an item prevents it from being changed
MyVar.IsProperty(ItemIs.Locked, true)
uc.EvalStr("x = 300") '// x cannot change here
Console.WriteLine(uc.EvalStr("x")) '// x retains the previous value
End Sub
End Module
100
200
200 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim MyVar = uc.DefineVariable("x = 100") Console.WriteLine(uc.EvalStr("x")) uc.EvalStr("x = 200") Console.WriteLine(uc.EvalStr("x")) '// x can change here '// Locking an item prevents it from being changed MyVar.IsProperty(ItemIs.Locked, true) uc.EvalStr("x = 300") '// x cannot change here Console.WriteLine(uc.EvalStr("x")) '// x retains the previous value End Sub End Module