uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026
Warning
uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.
Properties / Getters / Setters
Product:
Class:
Explains the different syntaxes for accessing uCalc properties, including native C#/VB property syntax, C++ method calls, and universal Get/Set methods.
Remarks
⚙️ Properties, Getters, and Setters
uCalc is designed with a consistent cross-platform API, but it also embraces idiomatic language features to provide a natural developer experience. Many members documented as "properties" can be accessed in several ways, depending on the language and coding style.
1. Native C# and VB.NET Properties
For C# and VB.NET developers, properties can be accessed using the familiar assignment (=) syntax. The uCalc engine maps these property accesses to the underlying getter and setter methods.
C#
// Gettervar value = myObject.PropertyName;// SettermyObject.PropertyName = "new value";VB.NET
' GetterDim value = myObject.PropertyName' SettermyObject.PropertyName = "new value"2. C++ Method Calls
C++ does not have a direct equivalent to C#/VB.NET properties. Instead, all property interactions are performed through explicit method calls. The getter is a parameterless method, and the setter is a method with one parameter.
// Getterauto value = myObject.PropertyName();// SettermyObject.PropertyName("new value");3. Universal Get/Set Methods (All Languages)
For complete cross-platform consistency, every property also has explicit Get... and Set... methods. These are available in all languages and are useful for library authors or teams working in multiple languages.
C#
var value = myObject.GetPropertyName();myObject.SetPropertyName("new value");VB.NET
Dim value = myObject.GetPropertyName()myObject.SetPropertyName("new value")C++
auto value = myObject.GetPropertyName();myObject.SetPropertyName("new value");✨ The Fluent Interface Advantage
The Set... methods have a special feature: they return the object instance itself. This enables a fluent interface, allowing you to chain multiple setter calls together into a single, readable statement.
// C# Example of chaining multiple Set... calls on DefaultRuleSett.GetDefaultRuleSet() .SetBracketSensitive(false) .SetCaseSensitive(false) .SetQuoteSensitive(false);Summary of Syntax
| Feature | C# | VB.NET | C++ |
|---|---|---|---|
| Getter | var x = t.MyProp; | Dim x = t.MyProp | auto x = t.MyProp(); |
| Setter | t.MyProp = "v"; | t.MyProp = "v" | t.MyProp("v"); |
| Prefixed getter | var x = t.GetMyProp(); | Dim x = t.GetMyProp() | auto x = t.GetMyProp(); |
| Fluent Setter | t.SetMyProp("v"); | t.SetMyProp("v") | t.SetMyProp("v"); |
💡 Why uCalc? (Comparative Analysis)
This multi-faceted API design reflects a pragmatic approach. Instead of forcing a single "one-size-fits-all" method, uCalc provides:
- Idiomatic APIs for C# and C++ developers, reducing the learning curve.
- A consistent, cross-platform API (
Get/Setmethods) for library authors or teams working in multiple languages. - A fluent interface for setters, which promotes clean and readable configuration code.
This is a distinct advantage over libraries that either expose a C-style method-only API (which feels unnatural in C#) or a property-only API (which is unusable in C++). uCalc's translation layer provides the best of all worlds.
Examples
Demonstrates the basic getter and setter syntax for a property
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Set the description using the property setter syntax
t.Description = "My Transformer";
// Get the description using the property getter syntax
Console.WriteLine($"Description: {t.Description}");
Description: My Transformer using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Set the description using the property setter syntax t.Description = "My Transformer"; // Get the description using the property getter syntax Console.WriteLine($"Description: {t.Description}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Set the description using the property setter syntax
t.Description("My Transformer");
// Get the description using the property getter syntax
cout << "Description: " << t.Description() << endl;
}
Description: My Transformer #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Set the description using the property setter syntax t.Description("My Transformer"); // Get the description using the property getter syntax cout << "Description: " << t.Description() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Set the description using the property setter syntax
t.Description = "My Transformer"
'// Get the description using the property getter syntax
Console.WriteLine($"Description: {t.Description}")
End Sub
End Module
Description: My Transformer Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Set the description using the property setter syntax t.Description = "My Transformer" '// Get the description using the property getter syntax Console.WriteLine($"Description: {t.Description}") End Sub End Module
A practical example using the fluent interface of `Set...` methods to configure multiple properties of a rule in a single chained statement.
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
var rule = t.FromTo("A", "B");
// Chain multiple Set... methods for a clean configuration
rule.SetCaseSensitive(true)
.SetWhitespaceSensitive(false)
.SetQuoteSensitive(false);
// Verify the properties were set using their corresponding getters
Console.WriteLine($"Case Sensitive: {rule.CaseSensitive}");
Console.WriteLine($"Whitespace Sensitive: {rule.WhitespaceSensitive}");
Console.WriteLine($"Quote Sensitive: {rule.QuoteSensitive}");
Case Sensitive: True
Whitespace Sensitive: False
Quote Sensitive: False using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); var rule = t.FromTo("A", "B"); // Chain multiple Set... methods for a clean configuration rule.SetCaseSensitive(true) .SetWhitespaceSensitive(false) .SetQuoteSensitive(false); // Verify the properties were set using their corresponding getters Console.WriteLine($"Case Sensitive: {rule.CaseSensitive}"); Console.WriteLine($"Whitespace Sensitive: {rule.WhitespaceSensitive}"); Console.WriteLine($"Quote Sensitive: {rule.QuoteSensitive}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
#define tf(IsTrue) ((IsTrue) ? "True" : "False")
int main() {
uCalc uc;
auto t = uc.NewTransformer();
auto rule = t.FromTo("A", "B");
// Chain multiple Set... methods for a clean configuration
rule.SetCaseSensitive(true)
.SetWhitespaceSensitive(false)
.SetQuoteSensitive(false);
// Verify the properties were set using their corresponding getters
cout << "Case Sensitive: " << tf(rule.CaseSensitive()) << endl;
cout << "Whitespace Sensitive: " << tf(rule.WhitespaceSensitive()) << endl;
cout << "Quote Sensitive: " << tf(rule.QuoteSensitive()) << endl;
}
Case Sensitive: True
Whitespace Sensitive: False
Quote Sensitive: False #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; #define tf(IsTrue) ((IsTrue) ? "True" : "False") int main() { uCalc uc; auto t = uc.NewTransformer(); auto rule = t.FromTo("A", "B"); // Chain multiple Set... methods for a clean configuration rule.SetCaseSensitive(true) .SetWhitespaceSensitive(false) .SetQuoteSensitive(false); // Verify the properties were set using their corresponding getters cout << "Case Sensitive: " << tf(rule.CaseSensitive()) << endl; cout << "Whitespace Sensitive: " << tf(rule.WhitespaceSensitive()) << endl; cout << "Quote Sensitive: " << tf(rule.QuoteSensitive()) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
Dim rule = t.FromTo("A", "B")
'// Chain multiple Set... methods for a clean configuration
rule.SetCaseSensitive(true).SetWhitespaceSensitive(false).SetQuoteSensitive(false)
'// Verify the properties were set using their corresponding getters
Console.WriteLine($"Case Sensitive: {rule.CaseSensitive}")
Console.WriteLine($"Whitespace Sensitive: {rule.WhitespaceSensitive}")
Console.WriteLine($"Quote Sensitive: {rule.QuoteSensitive}")
End Sub
End Module
Case Sensitive: True
Whitespace Sensitive: False
Quote Sensitive: False Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() Dim rule = t.FromTo("A", "B") '// Chain multiple Set... methods for a clean configuration rule.SetCaseSensitive(true).SetWhitespaceSensitive(false).SetQuoteSensitive(false) '// Verify the properties were set using their corresponding getters Console.WriteLine($"Case Sensitive: {rule.CaseSensitive}") Console.WriteLine($"Whitespace Sensitive: {rule.WhitespaceSensitive}") Console.WriteLine($"Quote Sensitive: {rule.QuoteSensitive}") End Sub End Module