1+ // Description: C# Expression Evaluator | Evaluate, Compile and Execute C# code and expression at runtime.
2+ // Website & Documentation: https://github.com/zzzprojects/Eval-Expression.NET
3+ // Forum & Issues: https://github.com/zzzprojects/Eval-Expression.NET/issues
4+ // License: https://github.com/zzzprojects/Eval-Expression.NET/blob/master/LICENSE
5+ // More projects: http://www.zzzprojects.com/
6+ // Copyright © ZZZ Projects Inc. 2014 - 2016. All rights reserved.
7+
8+ using System ;
9+ using System . Collections ;
10+ using System . Collections . Generic ;
11+
12+ namespace Z . Expressions
13+ {
14+ public static partial class Eval
15+ {
16+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
17+ /// <param name="code">The code or expression to compile.</param>
18+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
19+ public static Func < object > Compile ( string code )
20+ {
21+ return EvalManager . DefaultContext . Compile ( code ) ;
22+ }
23+
24+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
25+ /// <param name="code">The code or expression to compile.</param>
26+ /// <param name="parameterTypes">Parameter types used to compile the code or expression.</param>
27+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
28+ public static Func < IEnumerable , object > Compile ( string code , IEnumerable < Type > parameterTypes )
29+ {
30+ return EvalManager . DefaultContext . Compile ( code , parameterTypes ) ;
31+ }
32+
33+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
34+ /// <param name="code">The code or expression to compile.</param>
35+ /// <param name="parameterTypes">Parameter types used to compile the code or expression.</param>
36+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
37+ public static Func < IEnumerable , object > Compile ( string code , params Type [ ] parameterTypes )
38+ {
39+ return EvalManager . DefaultContext . Compile ( code , parameterTypes ) ;
40+ }
41+
42+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
43+ /// <param name="code">The code or expression to compile.</param>
44+ /// <param name="parameterTypes">Parameter types used to compile the code or expression.</param>
45+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
46+ public static Func < IDictionary , object > Compile ( string code , IDictionary < string , Type > parameterTypes )
47+ {
48+ return EvalManager . DefaultContext . Compile ( code , parameterTypes ) ;
49+ }
50+
51+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
52+ /// <param name="code">The code or expression to compile.</param>
53+ /// <param name="type1">The first type used to compile the code or expression.</param>
54+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
55+ public static Func < object , object > Compile ( string code , Type type1 )
56+ {
57+ return EvalManager . DefaultContext . Compile ( code , type1 ) ;
58+ }
59+
60+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
61+ /// <param name="code">The code or expression to compile.</param>
62+ /// <param name="type1">The first type used to compile the code or expression.</param>
63+ /// <param name="type2">The second type used to compile the code or expression.</param>
64+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
65+ public static Func < object , object , object > Compile ( string code , Type type1 , Type type2 )
66+ {
67+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 ) ;
68+ }
69+
70+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
71+ /// <param name="code">The code or expression to compile.</param>
72+ /// <param name="type1">The first type used to compile the code or expression.</param>
73+ /// <param name="type2">The second type used to compile the code or expression.</param>
74+ /// <param name="type3">The third type used to compile the code or expression.</param>
75+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
76+ public static Func < object , object , object , object > Compile ( string code , Type type1 , Type type2 , Type type3 )
77+ {
78+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 , type3 ) ;
79+ }
80+
81+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
82+ /// <param name="code">The code or expression to compile.</param>
83+ /// <param name="type1">The first type used to compile the code or expression.</param>
84+ /// <param name="type2">The second type used to compile the code or expression.</param>
85+ /// <param name="type3">The third type used to compile the code or expression.</param>
86+ /// <param name="type4">The fourth type used to compile the code or expression.</param>
87+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
88+ public static Func < object , object , object , object , object > Compile ( string code , Type type1 , Type type2 , Type type3 , Type type4 )
89+ {
90+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 , type3 , type4 ) ;
91+ }
92+
93+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
94+ /// <param name="code">The code or expression to compile.</param>
95+ /// <param name="type1">The first type used to compile the code or expression.</param>
96+ /// <param name="type2">The second type used to compile the code or expression.</param>
97+ /// <param name="type3">The third type used to compile the code or expression.</param>
98+ /// <param name="type4">The fourth type used to compile the code or expression.</param>
99+ /// <param name="type5">The fifth type used to compile the code or expression.</param>
100+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
101+ public static Func < object , object , object , object , object , object > Compile ( string code , Type type1 , Type type2 , Type type3 , Type type4 , Type type5 )
102+ {
103+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 , type3 , type4 , type5 ) ;
104+ }
105+
106+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
107+ /// <param name="code">The code or expression to compile.</param>
108+ /// <param name="type1">The first type used to compile the code or expression.</param>
109+ /// <param name="type2">The second type used to compile the code or expression.</param>
110+ /// <param name="type3">The third type used to compile the code or expression.</param>
111+ /// <param name="type4">The fourth type used to compile the code or expression.</param>
112+ /// <param name="type5">The fifth type used to compile the code or expression.</param>
113+ /// <param name="type6">The sixth type used to compile the code or expression.</param>
114+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
115+ public static Func < object , object , object , object , object , object , object > Compile ( string code , Type type1 , Type type2 , Type type3 , Type type4 , Type type5 , Type type6 )
116+ {
117+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 , type3 , type4 , type5 , type6 ) ;
118+ }
119+
120+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
121+ /// <param name="code">The code or expression to compile.</param>
122+ /// <param name="type1">The first type used to compile the code or expression.</param>
123+ /// <param name="type2">The second type used to compile the code or expression.</param>
124+ /// <param name="type3">The third type used to compile the code or expression.</param>
125+ /// <param name="type4">The fourth type used to compile the code or expression.</param>
126+ /// <param name="type5">The fifth type used to compile the code or expression.</param>
127+ /// <param name="type6">The sixth type used to compile the code or expression.</param>
128+ /// <param name="type7">The seventh type used to compile the code or expression.</param>
129+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
130+ public static Func < object , object , object , object , object , object , object , object > Compile ( string code , Type type1 , Type type2 , Type type3 , Type type4 , Type type5 , Type type6 , Type type7 )
131+ {
132+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 , type3 , type4 , type5 , type6 , type7 ) ;
133+ }
134+
135+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
136+ /// <param name="code">The code or expression to compile.</param>
137+ /// <param name="type1">The first type used to compile the code or expression.</param>
138+ /// <param name="type2">The second type used to compile the code or expression.</param>
139+ /// <param name="type3">The third type used to compile the code or expression.</param>
140+ /// <param name="type4">The fourth type used to compile the code or expression.</param>
141+ /// <param name="type5">The fifth type used to compile the code or expression.</param>
142+ /// <param name="type6">The sixth type used to compile the code or expression.</param>
143+ /// <param name="type7">The seventh type used to compile the code or expression.</param>
144+ /// <param name="type8">The eighth type used to compile the code or expression.</param>
145+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
146+ public static Func < object , object , object , object , object , object , object , object , object > Compile ( string code , Type type1 , Type type2 , Type type3 , Type type4 , Type type5 , Type type6 , Type type7 , Type type8 )
147+ {
148+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 , type3 , type4 , type5 , type6 , type7 , type8 ) ;
149+ }
150+
151+ /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
152+ /// <param name="code">The code or expression to compile.</param>
153+ /// <param name="type1">The first type used to compile the code or expression.</param>
154+ /// <param name="type2">The second type used to compile the code or expression.</param>
155+ /// <param name="type3">The third type used to compile the code or expression.</param>
156+ /// <param name="type4">The fourth type used to compile the code or expression.</param>
157+ /// <param name="type5">The fifth type used to compile the code or expression.</param>
158+ /// <param name="type6">The sixth type used to compile the code or expression.</param>
159+ /// <param name="type7">The seventh type used to compile the code or expression.</param>
160+ /// <param name="type8">The eighth type used to compile the code or expression.</param>
161+ /// <param name="type9">The ninth type used to compile the code or expression.</param>
162+ /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
163+ public static Func < object , object , object , object , object , object , object , object , object , object > Compile ( string code , Type type1 , Type type2 , Type type3 , Type type4 , Type type5 , Type type6 , Type type7 , Type type8 , Type type9 )
164+ {
165+ return EvalManager . DefaultContext . Compile ( code , type1 , type2 , type3 , type4 , type5 , type6 , type7 , type8 , type9 ) ;
166+ }
167+ }
168+ }
0 commit comments