LeMP.MacroProcessor.AsDelegate C# (CSharp) Method

AsDelegate() static private method

static private AsDelegate ( MethodInfo method, IMessageSink sink, object instance ) : LexicalMacro
method System.Reflection.MethodInfo
sink IMessageSink
instance object
return LexicalMacro
		static LexicalMacro AsDelegate(MethodInfo method, IMessageSink sink, object instance)
		{
			try {
				return (LexicalMacro)Delegate.CreateDelegate(typeof(LexicalMacro), method.IsStatic ? null : instance, method);
			} catch (Exception e) {
				sink.Write(Severity.Note, method.DeclaringType, "Macro '{0}' is uncallable: {1}", method.Name, e.Message);
				return null;
			}
		}