Skip to content

Commit cfcf287

Browse files
committed
Comments rewritting and formating
1 parent 79143a8 commit cfcf287

File tree

1 file changed

+60
-58
lines changed

1 file changed

+60
-58
lines changed

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,10 @@ protected enum TryBlockEvaluatedState
464464
#region Caching
465465

466466
/// <summary>
467-
/// if set to <c>true</c> use a cache for types that were resolved to resolve faster next time.
468-
/// if set to <c>false</c> the cache of types resolution is not use for this instance of ExpressionEvaluator.
469-
/// Default : false
470-
/// the cache is the static Dictionary TypesResolutionCaching (so it is shared by all instances of ExpressionEvaluator that have CacheTypesResolutions enabled)
467+
/// if set to <c>true</c> use a cache for types that were resolved to resolve faster next time.<para/>
468+
/// if set to <c>false</c> the cache of types resolution is not use for this instance of ExpressionEvaluator.<para/>
469+
/// Default : false<para/>
470+
/// The cache is the static Dictionary TypesResolutionCaching (so it is shared by all instances of ExpressionEvaluator that have CacheTypesResolutions enabled)
471471
/// </summary>
472472
public bool CacheTypesResolutions { get; set; }
473473

@@ -492,8 +492,8 @@ public static void ClearAllCaches()
492492
private IList<Assembly> assemblies;
493493

494494
/// <summary>
495-
/// All assemblies needed to resolves Types
496-
/// by default all Assemblies loaded in the current AppDomain
495+
/// All assemblies needed to resolves Types<para/>
496+
/// By default all assemblies loaded in the current AppDomain
497497
/// </summary>
498498
public virtual IList<Assembly> Assemblies
499499
{
@@ -502,7 +502,8 @@ public virtual IList<Assembly> Assemblies
502502
}
503503

504504
/// <summary>
505-
/// All Namespaces Where to find types
505+
/// All Namespaces Where to find types<para/>
506+
/// Equivalent of a <c>using Namespace;</c>
506507
/// </summary>
507508
public virtual IList<string> Namespaces { get; set; } = new List<string>()
508509
{
@@ -716,92 +717,94 @@ public bool OptionNewFunctionEvaluationActive
716717
}
717718

718719
/// <summary>
719-
/// if <c>true</c> allow to create instance of object with the C# syntax new ClassName(...).
720-
/// if <c>false</c> unactive this functionality.
720+
/// if <c>true</c> allow to create instance of object with the C# syntax new ClassName(...).<para/>
721+
/// if <c>false</c> unactive this functionality.<para/>
721722
/// By default : true
722723
/// </summary>
723724
public bool OptionNewKeywordEvaluationActive { get; set; } = true;
724725

725726
/// <summary>
726-
/// if <c>true</c> allow to call static methods on classes.
727-
/// if <c>false</c> unactive this functionality.
727+
/// if <c>true</c> allow to call static methods on classes.<para/>
728+
/// if <c>false</c> unactive this functionality.<para/>
728729
/// By default : true
729730
/// </summary>
730731
public bool OptionStaticMethodsCallActive { get; set; } = true;
731732

732733
/// <summary>
733-
/// if <c>true</c> allow to get static properties on classes
734-
/// if <c>false</c> unactive this functionality.
734+
/// if <c>true</c> allow to get static properties on classes<para/>
735+
/// if <c>false</c> unactive this functionality.<para/>
735736
/// By default : true
736737
/// </summary>
737738
public bool OptionStaticPropertiesGetActive { get; set; } = true;
738739

739740
/// <summary>
740-
/// if <c>true</c> allow to call instance methods on objects.
741-
/// if <c>false</c> unactive this functionality.
741+
/// if <c>true</c> allow to call instance methods on objects.<para/>
742+
/// if <c>false</c> unactive this functionality.<para/>
742743
/// By default : true
743744
/// </summary>
744745
public bool OptionInstanceMethodsCallActive { get; set; } = true;
745746

746747
/// <summary>
747-
/// if <c>true</c> allow to get instance properties on objects
748-
/// if <c>false</c> unactive this functionality.
748+
/// if <c>true</c> allow to get instance properties on objects<para/>
749+
/// if <c>false</c> unactive this functionality.<para/>
749750
/// By default : true
750751
/// </summary>
751752
public bool OptionInstancePropertiesGetActive { get; set; } = true;
752753

753754
/// <summary>
754-
/// if <c>true</c> allow to get object at index or key like IndexedObject[indexOrKey]
755-
/// if <c>false</c> unactive this functionality.
755+
/// if <c>true</c> allow to get object at index or key like <c>IndexedObject[indexOrKey]</c><para/>
756+
/// if <c>false</c> unactive this functionality.<para/>
756757
/// By default : true
757758
/// </summary>
758759
public bool OptionIndexingActive { get; set; } = true;
759760

760761
/// <summary>
761-
/// if <c>true</c> allow string interpretation with ""
762-
/// if <c>false</c> unactive this functionality.
762+
/// if <c>true</c> allow string interpretation with ""<para/>
763+
/// if <c>false</c> unactive this functionality.<para/>
763764
/// By default : true
764765
/// </summary>
765766
public bool OptionStringEvaluationActive { get; set; } = true;
766767

767768
/// <summary>
768-
/// if <c>true</c> allow char interpretation with ''
769-
/// if <c>false</c> unactive this functionality.
769+
/// if <c>true</c> allow char interpretation with ''<para/>
770+
/// if <c>false</c> unactive this functionality.<para/>
770771
/// By default : true
771772
/// </summary>
772773
public bool OptionCharEvaluationActive { get; set; } = true;
773774

774775
/// <summary>
775-
/// If <c>true</c> Evaluate function is callables in an expression. If <c>false</c> Evaluate is not callable.
776-
/// By default : true
776+
/// If <c>true</c> Evaluate function is callables in an expression.<para/>
777+
/// If <c>false</c> Evaluate is not callable.<para/>
778+
/// By default : true<para/>
777779
/// if set to false for security (also ensure that ExpressionEvaluator type is in TypesToBlock list)
778780
/// </summary>
779781
public bool OptionEvaluateFunctionActive { get; set; } = true;
780782

781783
/// <summary>
782-
/// If <c>true</c> allow to assign a value to a variable in the Variable disctionary with (=, +=, -=, *=, /=, %=, &amp;=, |=, ^=, &lt;&lt;=, &gt;&gt;=, ++ or --)
783-
/// If <c>false</c> unactive this functionality
784+
/// If <c>true</c> allow to assign a value to a variable in the Variable disctionary with (=, +=, -=, *=, /=, %=, &amp;=, |=, ^=, &lt;&lt;=, &gt;&gt;=, ++ or --)<para/>
785+
/// If <c>false</c> unactive this functionality<para/>
784786
/// By default : true
785787
/// </summary>
786788
public bool OptionVariableAssignationActive { get; set; } = true;
787789

788790
/// <summary>
789-
/// If <c>true</c> allow to set/modify a property or a field value with (=, +=, -=, *=, /=, %=, &amp;=, |=, ^=, &lt;&lt;=, &gt;&gt;=, ++ or --)
790-
/// If <c>false</c> unactive this functionality
791+
/// If <c>true</c> allow to set/modify a property or a field value with (=, +=, -=, *=, /=, %=, &amp;=, |=, ^=, &lt;&lt;=, &gt;&gt;=, ++ or --)<para/>
792+
/// If <c>false</c> unactive this functionality<para/>
791793
/// By default : true
792794
/// </summary>
793795
public bool OptionPropertyOrFieldSetActive { get; set; } = true;
794796

795797
/// <summary>
796-
/// If <c>true</c> allow to assign a indexed element like Collections, List, Arrays and Dictionaries with (=, +=, -=, *=, /=, %=, &amp;=, |=, ^=, &lt;&lt;=, &gt;&gt;=, ++ or --)
797-
/// If <c>false</c> unactive this functionality
798+
/// If <c>true</c> allow to assign a indexed element like Collections, List, Arrays and Dictionaries with (=, +=, -=, *=, /=, %=, &amp;=, |=, ^=, &lt;&lt;=, &gt;&gt;=, ++ or --)<para/>
799+
/// If <c>false</c> unactive this functionality<para/>
798800
/// By default : true
799801
/// </summary>
800802
public bool OptionIndexingAssignationActive { get; set; } = true;
801803

802804
/// <summary>
803-
/// If <c>true</c> ScriptEvaluate function is callables in an expression. If <c>false</c> Evaluate is not callable.
804-
/// By default : true
805+
/// If <c>true</c> ScriptEvaluate function is callables in an expression.<para/>
806+
/// If <c>false</c> Evaluate is not callable.<para/>
807+
/// By default : true<para/>
805808
/// if set to false for security (also ensure that ExpressionEvaluator type is in TypesToBlock list)
806809
/// </summary>
807810
public bool OptionScriptEvaluateFunctionActive { get; set; } = true;
@@ -823,24 +826,24 @@ public bool OptionNewFunctionEvaluationActive
823826
public bool OptionScriptNeedSemicolonAtTheEndOfLastExpression { get; set; } = true;
824827

825828
/// <summary>
826-
/// If <c>true</c> Allow to access fields, properties and methods that are not declared public. (private, protected and internal)
827-
/// If <c>false</c> Allow to access only to public members.
828-
/// Default : false
829+
/// If <c>true</c> Allow to access fields, properties and methods that are not declared public. (private, protected and internal)<para/>
830+
/// If <c>false</c> Allow to access only to public members.<para/>
831+
/// Default : false<para/>
829832
/// Warning : This clearly break the encapsulation principle use this only if you know what you do.
830833
/// </summary>
831834
public bool OptionAllowNonPublicMembersAccess { get; set; }
832835

833836
/// <summary>
834-
/// If <c>true</c> On unsuccessful call to an extension method, all defined overloads of that method are detected to resolve whether method is defined and called with wrong arguments or method is not defined.
835-
/// If <c>false</c> Unsucessful call to an extension method will always result in "Method {name} is not defined on type {type}"
837+
/// If <c>true</c> On unsuccessful call to an extension method, all defined overloads of that method are detected to resolve whether method is defined and called with wrong arguments or method is not defined.<para/>
838+
/// If <c>false</c> Unsucessful call to an extension method will always result in "Method {name} is not defined on type {type}"<para/>
836839
/// Default : true
837840
/// </summary>
838841
public bool OptionDetectExtensionMethodsOverloadsOnExtensionMethodNotFound { get; set; } = true;
839842

840843
/// <summary>
841844
/// If <c>true</c> Allow to define multi expression lambda in Expressions (not in script)<para/>
842-
/// If <c>false</c> Can only define simple expression lambda if not in script
843-
/// <para>Default value : <c>true</c></para>
845+
/// If <c>false</c> Can only define simple expression lambda if not in script<para/>
846+
/// Default value : <c>true</c>
844847
/// </summary>
845848
public bool OptionCanDeclareMultiExpressionsLambdaInSimpleExpressionEvaluate { get; set; } = true;
846849

@@ -905,7 +908,8 @@ public object Context
905908
private int evaluationStackCount;
906909

907910
/// <summary>
908-
/// The values of the variable use in the expressions
911+
/// A Dictionary of variable name/value that can be use in expressions and scripts evaluate by the current instance of <see cref="ExpressionEvaluator"/><para/>
912+
/// Warning : Make a copy of the given dictionary to manage casing.
909913
/// </summary>
910914
public IDictionary<string, object> Variables
911915
{
@@ -924,52 +928,52 @@ public IDictionary<string, object> Variables
924928
}
925929

926930
/// <summary>
927-
/// Is fired just before an expression is evaluate.
931+
/// Is fired just before an expression is evaluate.<para/>
928932
/// Allow to redefine the expression to evaluate or to force a result value.
929933
/// </summary>
930934
public event EventHandler<ExpressionEvaluationEventArg> ExpressionEvaluating;
931935

932936
/// <summary>
933-
/// Is fired just before to return the expression evaluation.
937+
/// Is fired just before to return the expression evaluation.<para/>
934938
/// Allow to modify on the fly the result of the evaluation.
935939
/// </summary>
936940
public event EventHandler<ExpressionEvaluationEventArg> ExpressionEvaluated;
937941

938942
/// <summary>
939-
/// Is fired before a variable, field or property resolution.
940-
/// Allow to define a variable and the corresponding value on the fly.
943+
/// Is fired before a variable, field or property resolution.<para/>
944+
/// Allow to define a variable and the corresponding value on the fly.<para/>
941945
/// Allow also to cancel the evaluation of this variable (consider it does'nt exists)
942946
/// </summary>
943947
public event EventHandler<VariablePreEvaluationEventArg> PreEvaluateVariable;
944948

945949
/// <summary>
946-
/// Is fired before a function or method resolution.
947-
/// Allow to define a function or method and the corresponding value on the fly.
950+
/// Is fired before a function or method resolution.<para/>
951+
/// Allow to define a function or method and the corresponding value on the fly.<para/>
948952
/// Allow also to cancel the evaluation of this function (consider it does'nt exists)
949953
/// </summary>
950954
public event EventHandler<FunctionPreEvaluationEventArg> PreEvaluateFunction;
951955

952956
/// <summary>
953-
/// Is fired before a indexing resolution.
954-
/// Allow to define an indexing and the corresponding value on the fly.
957+
/// Is fired before a indexing resolution.<para/>
958+
/// Allow to define an indexing and the corresponding value on the fly.<para/>
955959
/// Allow also to cancel the evaluation of this indexing (consider it does'nt exists)
956960
/// </summary>
957961
public event EventHandler<IndexingPreEvaluationEventArg> PreEvaluateIndexing;
958962

959963
/// <summary>
960-
/// Is fired if no variable, field or property were found
964+
/// Is fired if no variable, field or property were found.<para/>
961965
/// Allow to define a variable and the corresponding value on the fly.
962966
/// </summary>
963967
public event EventHandler<VariableEvaluationEventArg> EvaluateVariable;
964968

965969
/// <summary>
966-
/// Is fired if no function or method were found.
970+
/// Is fired if no function or method were found.<para/>
967971
/// Allow to define a function or method and the corresponding value on the fly.
968972
/// </summary>
969973
public event EventHandler<FunctionEvaluationEventArg> EvaluateFunction;
970974

971975
/// <summary>
972-
/// Is fired when a parameter is not of the correct type for the function.
976+
/// Is fired when a parameter is not of the correct type for the function.<para/>
973977
/// Allow to define a custom parameter cast to make the function call work on the fly.
974978
/// </summary>
975979
public event EventHandler<ParameterCastEvaluationEventArg> EvaluateParameterCast;
@@ -1060,9 +1064,8 @@ protected virtual void Init()
10601064
protected bool inScript;
10611065

10621066
/// <summary>
1063-
/// Evaluate a script (multiple expressions separated by semicolon)
1064-
/// Support Assignation with [=] (for simple variable write in the Variables dictionary)
1065-
/// support also if, else if, else while and for keywords
1067+
/// Evaluate a script (multiple expressions separated by semicolon)<para/>
1068+
/// support some conditional, loop and other C# code flow management keywords
10661069
/// </summary>
10671070
/// <typeparam name="T">The type in which to cast the result of the expression</typeparam>
10681071
/// <param name="script">the script to evaluate</param>
@@ -1073,9 +1076,8 @@ public virtual T ScriptEvaluate<T>(string script)
10731076
}
10741077

10751078
/// <summary>
1076-
/// Evaluate a script (multiple expressions separated by semicolon)
1077-
/// Support Assignation with [=] (for simple variable write in the Variables dictionary)
1078-
/// support also if, else if, else while and for keywords
1079+
/// Evaluate a script (multiple expressions separated by semicolon)<para/>
1080+
/// support some conditional, loop and other C# code flow management keywords
10791081
/// </summary>
10801082
/// <param name="script">the script to evaluate</param>
10811083
/// <returns>The result of the last evaluated expression</returns>

0 commit comments

Comments
 (0)