/// <summary>Finalize the prefab and compile into lambda.</summary>
            public Delegate lateBind(LateBindVisitor visitor)
            {
                visitor.bindMethod(eNativeDelegate, methodIndex, tNativeDelegate);
                Expression       eBody  = visitor.Visit(methodExpression);
                LambdaExpression lambda = Expression.Lambda(tManagedDelegate, eBody, managedParameters);

                return(lambda.Compile());
            }
 /// <summary>Create a function which takes native pointer + vtable, and compiles custom marshaled methods for a COM interface.</summary>
 static Func <IntPtr, IntPtr[], Delegate[]> createLateBinder(CustomMarshallerMethod[] customMethods)
 {
     return((IntPtr nativeObject, IntPtr[] vtable) =>
     {
         LateBindVisitor visitor = new LateBindVisitor(nativeObject, vtable);
         Delegate[] delegates = new Delegate[customMethods.Length];
         for (int i = 0; i < customMethods.Length; i++)
         {
             delegates[i] = customMethods[i].lateBind(visitor);
         }
         return delegates;
     });
 }