@@ -5,7 +5,7 @@ description: Options to customize the context under which the C# expression is c
55permalink : options
66---
77
8- {% include template-h1.html %}
8+
99
1010## Description
1111{{ page.description }}
@@ -14,25 +14,25 @@ permalink: options
1414Gets or sets the value of the BindingFlags to use to retrieve member (Constructor, Method, Property, and Field)
1515
1616### Example
17- {% highlight csharp %}
17+ ``` csharp
1818// using Z.Expressions; // Don't forget to include this.
1919var context = new EvalContext ();
2020
2121// Make member case insensitive (Math.pOW = Math.Pow)
2222context .BindingFlags = BindingFlags .IgnoreCase | context .BindingFlags
23- {% endhighlight %}
23+ ```
2424
2525## CacheKeyPrefix
2626Gets or sets the can key prefix to use to cache compiled delegate in the memory.
2727
2828> We recommend always to use a different cache key prefix if you modify the options.
2929
3030### Example
31- {% highlight csharp %}
31+ ``` csharp
3232// using Z.Expressions; // Don't forget to include this.
3333 var context = new EvalContext();
3434context .CacheKey = Guid .NewGuid ().ToString ();
35- {% endhighlight %}
35+ ```
3636
3737## IncludeMemberFromAllParameters
3838Gets or sets if all members should be included from all parameters.
@@ -42,33 +42,33 @@ By default, member are only included when one parameter is specified.
4242> This configuration can be very useful to disable if you execute multiple expression only once, and you believe they will never be re-used.
4343
4444### Example
45- {% highlight csharp %}
45+ ``` csharp
4646// using Z.Expressions; // Don't forget to include this.
4747var context = new EvalContext ();
4848context .IncludeMemberFromAllParameters = true ;
4949
5050Eval .Execute <bool >(" catPropertyName == dogPropertyName" , cat , dog );
51- {% endhighlight %}
51+ ```
5252
5353## UseCache
5454Gets or sets if compiled delegate shoud be cached in the memory or not.
5555
5656> This configuration can be very useful to disable if you execute multiple expression only once, and you believe they will never be re-used.
5757
5858### Example
59- {% highlight csharp %}
59+ ``` csharp
6060// using Z.Expressions; // Don't forget to include this.
6161var context = new EvalContext ();
6262context .UseCache = false ;
63- {% endhighlight %}
63+ ```
6464
6565## UseCaretForExponent
6666Gets or sets if the default behavior for the XOR operator '^' must act like an exponent operator instead.
6767
6868> A new operator '^|' is available for the bitwise exclusive-OR operator.
6969
7070### Example
71- {% highlight csharp %}
71+ ``` csharp
7272// using Z.Expressions; // Don't forget to include this.
7373var context = new EvalContext () { UseCache = false };
7474
@@ -78,15 +78,15 @@ context.UseCaretForExponent = true;
7878var exponentValue = = context .Eval (" 2^3" ); // return 8;
7979
8080var newExlusiveOrValue = = context .Eval (" 2^|3" ); // return 1;
81- {% endhighlight %}
81+ ```
8282
8383## Clone
8484Create a new a shallow copy of the current EvalContext
8585
8686> Cloning the EvalContext can be useful to copy all options including all types already registered to use it to change only what's required for the expression to evaluate.
8787
8888### Example
89- {% highlight csharp %}
89+ ``` csharp
9090// using Z.Expressions; // Don't forget to include this.
9191var context = EvalManager .DefaultContext .Clone ();
92- {% endhighlight %}
92+ ```
0 commit comments