示例#1
0
 /// <summary>
 /// Invokes the static method specified by <paramref name="name"/> matching <paramref name="bindingFlags"/>
 /// of the given <paramref name="type"/> using <paramref name="parameters"/> as arguments.
 /// a parameter types are specified by <paramref name="parameterTypes"/>.
 /// </summary>
 /// <returns>The return value of the method.</returns>
 /// <remarks>If the method has no return type, <c>null</c> is returned.</remarks>
 public static object Invoke(this Type type, string name, Type[] parameterTypes, Flags bindingFlags, params object[] parameters)
 {
     return(DelegateForCallStaticMethod(type, name, bindingFlags, parameterTypes)(parameters));
 }
示例#2
0
 /// <summary>
 /// Invokes the static method specified by <paramref name="name"/> of the given
 /// <paramref name="type"/> using <paramref name="parameters"/> as arguments.
 /// a parameter types are specified by <paramref name="parameterTypes"/>.
 /// </summary>
 /// <returns>The return value of the method.</returns>
 /// <remarks>If the method has no return type, <c>null</c> is returned.</remarks>
 public static object Invoke(this Type type, string name, Type[] parameterTypes, params object[] parameters)
 {
     return(DelegateForCallStaticMethod(type, name, parameterTypes ?? parameters.ToTypeArray())(parameters));
 }