Westwind.Utilities.Expando.InvokeMethod C# (CSharp) Méthode

InvokeMethod() protected méthode

Reflection helper method to invoke a method
protected InvokeMethod ( object instance, string name, object args, object &result ) : bool
instance object
name string
args object
result object
Résultat bool
        protected bool InvokeMethod(object instance, string name, object[] args, out object result)
        {
            if (instance == null)
                instance = this;

            // Look at the instanceType
            var miArray = InstanceType.GetMember(name,
                                    BindingFlags.InvokeMethod |
                                    BindingFlags.Public | BindingFlags.Instance);

            if (miArray != null && miArray.Length > 0)
            {
                var mi = miArray[0] as MethodInfo;
                result = mi.Invoke(Instance, args);
                return true;
            }

            result = null;
            return false;
        }