Click here to Skip to main content
15,891,136 members
Articles / Web Development / HTML

Dynamic Expresso

Rate me:
Please Sign up or sign in to vote.
4.91/5 (44 votes)
18 Jan 2015MIT11 min read 80.6K   935   72  
Generate LambdaExpression or function delegate on the fly without compilation.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynamicExpresso
{
	[Flags]
	public enum InterpreterOptions
	{
		None = 0,
		/// <summary>
		/// Load primitive types like 'string', 'double', 'int', 'DateTime', 'Guid', ... See also LanguageConstants.CSharpPrimitiveTypes and LanguageConstants.PrimitiveTypes
		/// </summary>
		PrimitiveTypes = 1,
		/// <summary>
		/// Load system keywords like 'true', 'false', 'null'. See also LanguageConstants.Literals.
		/// </summary>
		SystemKeywords = 2,
		/// <summary>
		/// Load common types like 'System.Math', 'System.Convert', 'System.Linq.Enumerable'. See also LanguageConstants.CommonTypes.
		/// </summary>
		CommonTypes = 4,
		/// <summary>
		/// Variables and parameters names are case insensitive.
		/// </summary>
		CaseInsensitive = 8,
		/// <summary>
		/// Load all default configurations: PrimitiveTypes + SystemKeywords + CommonTypes
		/// </summary>
		Default = PrimitiveTypes | SystemKeywords | CommonTypes,
		/// <summary>
		/// Load all default configurations: PrimitiveTypes + SystemKeywords + CommonTypes + CaseInsensitive
		/// </summary>
		DefaultCaseInsensitive = PrimitiveTypes | SystemKeywords | CommonTypes | CaseInsensitive,
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions