Skip to content

Instantly share code, notes, and snippets.

View Antaris's full-sized avatar
🎯
Focusing

Matthew Abbott Antaris

🎯
Focusing
View GitHub Profile
@Antaris
Antaris / FunctionFactory.cs
Created April 11, 2011 20:28
Extends the System.Linq.Dynamic.ExpressionParser sample to build a generic expression parser.
public static class FunctionFactory
{
private static Delegate CreateInternal(Type[] argumentTypes, Type returnType, string expression, string[] argumentNames = null)
{
if (argumentNames != null)
{
if (argumentTypes.Length != argumentNames.Length)
throw new ArgumentException("The number of argument names does not equal the number of argument types.");
}