Skip to content

Commit 8e7f732

Browse files
Update options.md
1 parent 983b38c commit 8e7f732

File tree

1 file changed

+22
-45
lines changed

1 file changed

+22
-45
lines changed

docs/pages/api/options.md

Lines changed: 22 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,58 @@
11
---
22
layout: default
33
title: Options
4+
description: Options to customize the context under which the C# expression is compiled.
45
permalink: options
56
---
67

78
{% include template-h1.html %}
89

9-
## Introduction
10-
The EvalContext allow customizing multiple options to change the context under which the code or expression is compiled.
10+
## Description
11+
{{ page.description }}
1112

1213
## BindingFlags
13-
### Problem
14-
You want to change default BindingFlags used to retrieve member (Constructor, Method, Property, and Field)
15-
16-
### Solution
17-
Use the **BindingFlags** property.
14+
Gets or sets the value of the BindingFlags to use to retrieve member (Constructor, Method, Property, and Field)
1815

1916
### Example
20-
```csharp
17+
{% highlight csharp %}
2118
// using Z.Expressions; // Don't forget to include this.
2219
var context = new EvalContext();
2320

2421
// Make member case insensitive (Math.pOW = Math.Pow)
2522
context.BindingFlags = BindingFlags.IgnoreCase | context.BindingFlags
26-
```
23+
{% endhighlight %}
2724

2825
## CacheKeyPrefix
29-
### Problem
30-
You want to change the cache key prefix used to cache compiled expression.
26+
Gets or sets the can key prefix to use to cache compiled delegate in the memory.
3127

32-
### Solution
33-
Use the **CacheKey** property.
28+
> We recommend always to use a different cache key prefix if you modify the options.
3429
3530
### Example
36-
```csharp
31+
{% highlight csharp %}
3732
// using Z.Expressions; // Don't forget to include this.
3833
var context = new EvalContext();
3934
context.CacheKey = Guid.NewGuid().ToString();
40-
```
41-
42-
### Discussion
43-
We recommend always to use a different cache key prefix if you use different options.
35+
{% endhighlight %}
4436

4537
## UseCache
46-
### Problem
47-
You want to disable the caching for compiled expression.
38+
Gets or sets if compiled delegate shoud be cached in the memory or not.
4839

49-
### Solution
50-
Use the **UseCache** property.
40+
> This configuration can be very useful to disable if you execute multiple expression only once, and you believe they will never be re-used.
5141
5242
### Example
53-
```csharp
43+
{% highlight csharp %}
5444
// using Z.Expressions; // Don't forget to include this.
5545
var context = new EvalContext();
5646
context.UseCache = false;
57-
```
58-
59-
### Discussion
60-
This configuration can be very useful to disable if you execute multiple expression only once, and you believe they will never be re-used.
47+
{% endhighlight %}
6148

6249
## UseCaretForExponent
63-
### Problem
64-
You want to change the XOR operator '^' to act like an exponent operator instead.
50+
Gets or sets if the default behavior for the XOR operator '^' must act like an exponent operator instead.
6551

66-
### Solution
67-
Use the **UseCaretForExponent** property.
52+
> A new operator '^|' is available for the bitwise exclusive-OR operator.
6853
6954
### Example
70-
```csharp
55+
{% highlight csharp %}
7156
// using Z.Expressions; // Don't forget to include this.
7257
var context = new EvalContext() { UseCache = false };
7358

@@ -77,23 +62,15 @@ context.UseCaretForExponent = true;
7762
var exponentValue = = context.Eval("2^3"); // return 8;
7863

7964
var newExlusiveOrValue = = context.Eval("2^|3"); // return 1;
80-
```
81-
82-
### Discussion
83-
A new operator '^|' is available for the bitwise exclusive-OR operator.
65+
{% endhighlight %}
8466

8567
## Clone
86-
### Problem
87-
You want to make a shallow copy of the current EvalContext
68+
Create a new a shallow copy of the current EvalContext
8869

89-
### Solution
90-
Use the **Clone** method.
70+
> 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.
9171
9272
### Example
93-
```csharp
73+
{% highlight csharp %}
9474
// using Z.Expressions; // Don't forget to include this.
9575
var context = EvalManager.DefaultContext.Clone();
96-
```
97-
98-
### Discussion
99-
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.
76+
{% endhighlight %}

0 commit comments

Comments
 (0)