@@ -24,7 +24,7 @@ namespace CodingSeb.ExpressionEvaluator
2424 /// <summary>
2525 /// This class allow to evaluate a string math or pseudo C# expression
2626 /// </summary>
27- public class ExpressionEvaluator
27+ public partial class ExpressionEvaluator
2828 {
2929 #region Regex declarations
3030
@@ -449,6 +449,12 @@ private enum TryBlockEvaluatedState
449449
450450 #endregion
451451
452+ #region Caching
453+
454+ public static IDictionary < string , Type > TypesResolutionCaching { get ; set ; } = new Dictionary < string , Type > ( ) ;
455+
456+ #endregion
457+
452458 #region Assemblies, Namespaces and types lists
453459
454460 /// <summary>
@@ -2971,7 +2977,9 @@ private Type GetTypeByFriendlyName(string typeName, string genericTypes = "", bo
29712977 Type result = null ;
29722978 try
29732979 {
2974- typeName = typeName . Trim ( ) ;
2980+ typeName = typeName . Replace ( " " , "" ) . Replace ( "\t " , "" ) . Replace ( "\r " , "" ) . Replace ( "\n " , "" ) ;
2981+ genericTypes = genericTypes . Replace ( " " , "" ) . Replace ( "\t " , "" ) . Replace ( "\r " , "" ) . Replace ( "\n " , "" ) ;
2982+
29752983 string formatedGenericTypes = string . Empty ;
29762984
29772985 if ( ! genericTypes . Equals ( string . Empty ) )
@@ -3256,7 +3264,7 @@ public enum OptionOnNoReturnKeywordFoundInScriptAction
32563264
32573265 #region ExpressionEvaluator linked public classes (specific Exceptions and EventArgs)
32583266
3259- public class ExpressionEvaluatorSyntaxErrorException : Exception
3267+ public partial class ExpressionEvaluatorSyntaxErrorException : Exception
32603268 {
32613269 public ExpressionEvaluatorSyntaxErrorException ( ) : base ( )
32623270 { }
@@ -3267,7 +3275,7 @@ public ExpressionEvaluatorSyntaxErrorException(string message, Exception innerEx
32673275 { }
32683276 }
32693277
3270- public class ExpressionEvaluatorSecurityException : Exception
3278+ public partial class ExpressionEvaluatorSecurityException : Exception
32713279 {
32723280 public ExpressionEvaluatorSecurityException ( ) : base ( )
32733281 { }
@@ -3278,7 +3286,7 @@ public ExpressionEvaluatorSecurityException(string message, Exception innerExcep
32783286 { }
32793287 }
32803288
3281- public class VariableEvaluationEventArg : EventArgs
3289+ public partial class VariableEvaluationEventArg : EventArgs
32823290 {
32833291 private readonly Func < string , Type [ ] > evaluateGenericTypes = null ;
32843292 private readonly string genericTypes = null ;
@@ -3354,7 +3362,7 @@ public Type[] EvaluateGenericTypes()
33543362 }
33553363 }
33563364
3357- public class FunctionEvaluationEventArg : EventArgs
3365+ public partial class FunctionEvaluationEventArg : EventArgs
33583366 {
33593367 private readonly Func < string , object > evaluateFunc = null ;
33603368 private readonly Func < string , Type [ ] > evaluateGenericTypes = null ;
0 commit comments