- Notifications
You must be signed in to change notification settings - Fork 101
ExpandoObject
Coding Seb edited this page May 30, 2019 · 4 revisions
From version 1.2.2 ExpressionEvaluator manage ExpandObject class. ExpandoObject are object that can dynamically create new properties when you assign a value to it. It is also a dictionnary of properties. In ExpressionEvaluator you can use it as a object or as a dictionnary.
Here some examples :
myVar = new ExpandoObject(); myVar.X = 23.5; myVar.Y = 34.8; return myVar.X + myVar.Y; // 58.3
myVar = new ExpandoObject(); myVar["Text"] = "Hello "; return myVar["Text"] + " Bob" ; // "Hello Bob"
myVar = new ExpandoObject(); myVar["Text"] = "Hello "; return myVar.Text + " Bob" ; // "Hello Bob"
myVar = new ExpandoObject(); myVar.Text = "Hello "; return myVar["Text"] + " Bob" ; // "Hello Bob"
obj = new ExpandoObject(); obj.Add = (x, y) => { text = "The result is : "; return text + (x+y).ToString(); }; return obj.Add(3, 4); // "The result is : 7"
And from version 1.3.7 ExpandoObject can be created as anonymous objects:
obj = new { Text = "Hello", IntValue = 8, Add = (x, y) => { text = "The result is : "; return text + (x+y).ToString(); } };
- Getting Started
- Variables and Functions
- Operators and Keywords
- C# Types Management
- ExpandoObject
- Code Comments Management
- Advanced Customization and Hacking
- Caching
- Options
- CultureInfoForNumberParsing
- OptionCaseSensitiveEvaluationActive
- OptionVariablesPersistenceCustomComparer
- OptionFluidPrefixingActive
- OptionForceIntegerNumbersEvaluationsAsDoubleByDefault
- OptionNumberParsingDecimalSeparator
- OptionNumberParsingThousandSeparator
- OptionFunctionArgumentsSeparator
- OptionInitializersSeparator
- OptionInlineNamespacesEvaluationRule
- OptionNewFunctionEvaluationActive
- OptionNewKeywordEvaluationActive
- OptionStaticMethodsCallActive
- OptionStaticProperiesGetActive
- OptionInstanceMethodsCallActive
- OptionInstanceProperiesGetActive
- OptionIndexingActive
- OptionStringEvaluationActive
- OptionCharEvaluationActive
- OptionEvaluateFunctionActive
- OptionVariableAssignationActive
- OptionPropertyOrFieldSetActive
- OptionIndexingAssignationActive
- OptionScriptEvaluateFunctionActive
- OptionOnNoReturnKeywordFoundInScriptAction
- OptionScriptNeedSemicolonAtTheEndOfLastExpression
- OptionAllowNonPublicMembersAccess
- Todo List