dynamicexpresso / DynamicExpresso

C# expressions interpreter

Home Page:http://dynamic-expresso.azurewebsites.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default configuration

davideicardi opened this issue · comments

Allow to specify if predefined types should be loaded. Default should be true.

Now it should be possible to specify some options when creating the Interpreter:

var target = new Interpreter(InterpreterOptions.Default);

[Flags]
public enum InterpreterOptions
{
    None = 0,
    /// <summary>
    /// Load primitive types like 'string', 'double', 'int', 'DateTime', 'Guid', ...
    /// </summary>
    PrimitiveTypes = 1,
    /// <summary>
    /// Load system keywords like 'true', 'false', 'null'
    /// </summary>
    SystemKeywords = 2,
    /// <summary>
    /// Load common types like 'System.Math', 'System.Convert'
    /// </summary>
    CommonTypes = 4,

    /// <summary>
    /// Load all default configurations: PrimitiveTypes + SystemKeywords + CommonTypes
    /// </summary>
    Default = PrimitiveTypes | SystemKeywords | CommonTypes
}

Default constructor has the same behavior as before.