mscorlib(4.0.0.0) API with additions
|
Provides information about methods and constructors. More...
Public Member Functions | |
override bool | Equals (object obj) |
Returns a value that indicates whether this instance is equal to a specified object. More... | |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
abstract ParameterInfo [] | GetParameters () |
When overridden in a derived class, gets the parameters of the specified method or constructor. More... | |
abstract MethodImplAttributes | GetMethodImplementationFlags () |
When overridden in a derived class, returns the T:System.Reflection.MethodImplAttributes flags. More... | |
abstract object | Invoke (object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) |
When overridden in a derived class, invokes the reflected method or constructor with the given parameters. More... | |
virtual Type [] | GetGenericArguments () |
Returns an array of T:System.Type objects that represent the type arguments of a generic method or the type parameters of a generic method definition. More... | |
object | Invoke (object obj, object[] parameters) |
Invokes the method or constructor represented by the current instance, using the specified parameters. More... | |
virtual MethodBody | GetMethodBody () |
When overridden in a derived class, gets a T:System.Reflection.MethodBody object that provides access to the MSIL stream, local variables, and exceptions for the current method. More... | |
![]() | |
abstract object [] | GetCustomAttributes (bool inherit) |
When overridden in a derived class, returns an array of all custom attributes applied to this member. More... | |
abstract object [] | GetCustomAttributes (Type attributeType, bool inherit) |
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by T:System.Type. More... | |
abstract bool | IsDefined (Type attributeType, bool inherit) |
When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member. More... | |
virtual IList< CustomAttributeData > | GetCustomAttributesData () |
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attributes that have been applied to the target member. More... | |
override bool | Equals (object obj) |
Returns a value that indicates whether this instance is equal to a specified object. More... | |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
![]() | |
new string | ToString () |
Provides COM objects with version-independent access to the M:System.Object.ToString method. More... | |
![]() | |
new string | ToString () |
Provides COM objects with version-independent access to the M:System.Object.ToString method. More... | |
object [] | GetCustomAttributes (Type attributeType, bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.GetCustomAttributes(System.Type,System.Boolean) method. More... | |
object [] | GetCustomAttributes (bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.GetCustomAttributes(System.Boolean) method. More... | |
bool | IsDefined (Type attributeType, bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.IsDefined(System.Type,System.Boolean) method. More... | |
Static Public Member Functions | |
static MethodBase | GetMethodFromHandle (RuntimeMethodHandle handle) |
Gets method information by using the method's internal metadata representation (handle). More... | |
static MethodBase | GetMethodFromHandle (RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) |
Gets a T:System.Reflection.MethodBase object for the constructor or method represented by the specified handle, for the specified generic type. More... | |
static MethodBase | GetCurrentMethod () |
Returns a MethodBase object representing the currently executing method. More... | |
static bool | operator== (MethodBase left, MethodBase right) |
Indicates whether two T:System.Reflection.MethodBase objects are equal. More... | |
static bool | operator != (MethodBase left, MethodBase right) |
Indicates whether two T:System.Reflection.MethodBase objects are not equal. More... | |
![]() | |
static bool | operator== (MemberInfo left, MemberInfo right) |
Indicates whether two T:System.Reflection.MemberInfo objects are equal. More... | |
static bool | operator != (MemberInfo left, MemberInfo right) |
Indicates whether two T:System.Reflection.MemberInfo objects are not equal. More... | |
Properties | |
virtual MethodImplAttributes | MethodImplementationFlags [get] |
Gets the T:System.Reflection.MethodImplAttributes flags that specify the attributes of a method implementation. More... | |
abstract RuntimeMethodHandle | MethodHandle [get] |
Gets a handle to the internal metadata representation of a method. More... | |
abstract MethodAttributes | Attributes [get] |
Gets the attributes associated with this method. More... | |
virtual CallingConventions | CallingConvention [get] |
Gets a value indicating the calling conventions for this method. More... | |
virtual bool | IsGenericMethodDefinition [get] |
Gets a value indicating whether the method is a generic method definition. More... | |
virtual bool | ContainsGenericParameters [get] |
Gets a value indicating whether the generic method contains unassigned generic type parameters. More... | |
virtual bool | IsGenericMethod [get] |
Gets a value indicating whether the method is generic. More... | |
virtual bool | IsSecurityCritical [get] |
Gets a value that indicates whether the current method or constructor is security-critical or security-safe-critical at the current trust level, and therefore can perform critical operations. More... | |
virtual bool | IsSecuritySafeCritical [get] |
Gets a value that indicates whether the current method or constructor is security-safe-critical at the current trust level; that is, whether it can perform critical operations and can be accessed by transparent code. More... | |
virtual bool | IsSecurityTransparent [get] |
Gets a value that indicates whether the current method or constructor is transparent at the current trust level, and therefore cannot perform critical operations. More... | |
bool | IsPublic [get] |
Gets a value indicating whether this is a public method. More... | |
bool | IsPrivate [get] |
Gets a value indicating whether this member is private. More... | |
bool | IsFamily [get] |
Gets a value indicating whether the visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.Family; that is, the method or constructor is visible only within its class and derived classes. More... | |
bool | IsAssembly [get] |
Gets a value indicating whether the potential visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.Assembly; that is, the method or constructor is visible at most to other types in the same assembly, and is not visible to derived types outside the assembly. More... | |
bool | IsFamilyAndAssembly [get] |
Gets a value indicating whether the visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.FamANDAssem; that is, the method or constructor can be called by derived classes, but only if they are in the same assembly. More... | |
bool | IsFamilyOrAssembly [get] |
Gets a value indicating whether the potential visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.FamORAssem; that is, the method or constructor can be called by derived classes wherever they are, and by classes in the same assembly. More... | |
bool | IsStatic [get] |
Gets a value indicating whether the method is static . More... | |
bool | IsFinal [get] |
Gets a value indicating whether this method is final . More... | |
bool | IsVirtual [get] |
Gets a value indicating whether the method is virtual . More... | |
bool | IsHideBySig [get] |
Gets a value indicating whether only a member of the same kind with exactly the same signature is hidden in the derived class. More... | |
bool | IsAbstract [get] |
Gets a value indicating whether the method is abstract. More... | |
bool | IsSpecialName [get] |
Gets a value indicating whether this method has a special name. More... | |
bool | IsConstructor [get] |
Gets a value indicating whether the method is a constructor. More... | |
![]() | |
abstract MemberTypes | MemberType [get] |
When overridden in a derived class, gets a T:System.Reflection.MemberTypes value indicating the type of the member — method, constructor, event, and so on. More... | |
abstract string | Name [get] |
Gets the name of the current member. More... | |
abstract Type | DeclaringType [get] |
Gets the class that declares this member. More... | |
abstract Type | ReflectedType [get] |
Gets the class object that was used to obtain this instance of MemberInfo . More... | |
virtual IEnumerable< CustomAttributeData > | CustomAttributes [get] |
Gets a collection that contains this member's custom attributes. More... | |
virtual int | MetadataToken [get] |
Gets a value that identifies a metadata element. More... | |
virtual Module | Module [get] |
Gets the module in which the type that declares the member represented by the current T:System.Reflection.MemberInfo is defined. More... | |
![]() | |
MemberTypes | MemberType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.MemberType property. More... | |
string | Name [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.Name property. More... | |
Type | DeclaringType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.DeclaringType property. More... | |
Type | ReflectedType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.ReflectedType property. More... | |
![]() | |
MemberTypes | MemberType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.MemberType property. More... | |
string | Name [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.Name property. More... | |
Type | DeclaringType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.DeclaringType property. More... | |
Type | ReflectedType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.ReflectedType property. More... | |
RuntimeMethodHandle | MethodHandle [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.MethodHandle property. More... | |
MethodAttributes | Attributes [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.Attributes property. More... | |
CallingConventions | CallingConvention [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.CallingConvention property. More... | |
bool | IsPublic [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsPublic property. More... | |
bool | IsPrivate [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsPrivate property. More... | |
bool | IsFamily [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsFamily property. More... | |
bool | IsAssembly [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsAssembly property. More... | |
bool | IsFamilyAndAssembly [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsFamilyAndAssembly property. More... | |
bool | IsFamilyOrAssembly [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsFamilyOrAssembly property. More... | |
bool | IsStatic [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsStatic property. More... | |
bool | IsFinal [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsFinal property. More... | |
bool | IsVirtual [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsVirtual property. More... | |
bool | IsHideBySig [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsHideBySig property. More... | |
bool | IsAbstract [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsAbstract property. More... | |
bool | IsSpecialName [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsSpecialName property. More... | |
bool | IsConstructor [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MethodBase.IsConstructor property. More... | |
Provides information about methods and constructors.
Definition at line 19 of file MethodBase.cs.
override bool System.Reflection.MethodBase.Equals | ( | object | obj | ) |
Returns a value that indicates whether this instance is equal to a specified object.
obj | An object to compare with this instance, or null . |
true
if obj equals the type and value of this instance; otherwise, false
.Implements System.Runtime.InteropServices._MethodBase.
Definition at line 546 of file MethodBase.cs.
|
static |
Returns a MethodBase
object representing the currently executing method.
MethodBase
object representing the currently executing method.T:System.Reflection.TargetException | This member was invoked with a late-binding mechanism. |
Definition at line 493 of file MethodBase.cs.
|
virtual |
Returns an array of T:System.Type objects that represent the type arguments of a generic method or the type parameters of a generic method definition.
T:System.NotSupportedException | The current object is a T:System.Reflection.ConstructorInfo. Generic constructors are not supported in the .NET Framework version 2.0. This exception is the default behavior if this method is not overridden in a derived class. |
Reimplemented in System.Reflection.Emit.MethodBuilder, and System.Reflection.MethodInfo.
Definition at line 599 of file MethodBase.cs.
override int System.Reflection.MethodBase.GetHashCode | ( | ) |
Returns the hash code for this instance.
Implements System.Runtime.InteropServices._MethodBase.
Definition at line 554 of file MethodBase.cs.
|
virtual |
When overridden in a derived class, gets a T:System.Reflection.MethodBody object that provides access to the MSIL stream, local variables, and exceptions for the current method.
T:System.InvalidOperationException | This method is invalid unless overridden in a derived class. |
Definition at line 631 of file MethodBase.cs.
|
static |
Gets method information by using the method's internal metadata representation (handle).
handle | The method's handle. |
MethodBase
containing information about the method.T:System.ArgumentException | handle is invalid. |
Definition at line 456 of file MethodBase.cs.
|
static |
Gets a T:System.Reflection.MethodBase object for the constructor or method represented by the specified handle, for the specified generic type.
handle | A handle to the internal metadata representation of a constructor or method. |
declaringType | A handle to the generic type that defines the constructor or method. |
T:System.ArgumentException | handle is invalid. |
Definition at line 479 of file MethodBase.cs.
|
pure virtual |
When overridden in a derived class, returns the T:System.Reflection.MethodImplAttributes flags.
MethodImplAttributes
flags.Implements System.Runtime.InteropServices._MethodBase.
Implemented in System.Reflection.Emit.DynamicMethod, System.Reflection.Emit.MethodBuilder, and System.Reflection.Emit.ConstructorBuilder.
|
pure virtual |
When overridden in a derived class, gets the parameters of the specified method or constructor.
ParameterInfo
containing information that matches the signature of the method (or constructor) reflected by this MethodBase
instance.Implements System.Runtime.InteropServices._MethodBase.
Implemented in System.Reflection.Emit.DynamicMethod, System.Reflection.Emit.MethodBuilder, and System.Reflection.Emit.ConstructorBuilder.
|
pure virtual |
When overridden in a derived class, invokes the reflected method or constructor with the given parameters.
obj | The object on which to invoke the method or constructor. If a method is static, this argument is ignored. If a constructor is static, this argument must be null or an instance of the class that defines the constructor. |
invokeAttr | A bitmask that is a combination of 0 or more bit flags from T:System.Reflection.BindingFlags. If binder is null , this parameter is assigned the value F:System.Reflection.BindingFlags.Default; thus, whatever you pass in is ignored. |
binder | An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects via reflection. If binder is null , the default binder is used. |
parameters | An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, this should be null .If the method or constructor represented by this instance takes a ByRef parameter, there is no special attribute required for that parameter in order to invoke the method or constructor using this function. Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is null . For value-type elements, this value is 0, 0.0, or false , depending on the specific element type. |
culture | An instance of CultureInfo used to govern the coercion of types. If this is null , the CultureInfo for the current thread is used. (This is necessary to convert a String that represents 1000 to a Double value, for example, since 1000 is represented differently by different cultures.) |
Object
containing the return value of the invoked method, or null
in the case of a constructor, or null
if the method's return type is void
. Before calling the method or constructor, Invoke
checks to see if the user has access permission and verifies that the parameters are valid.Elements of the parameters array that represent parameters declared with the ref
or out
keyword may also be modified.T:System.Reflection.TargetException | The obj parameter is null and the method is not static.-or- The method is not declared or inherited by the class of obj . -or-A static constructor is invoked, and obj is neither null nor an instance of the class that declared the constructor. |
T:System.ArgumentException | The type of the parameters parameter does not match the signature of the method or constructor reflected by this instance. |
T:System.Reflection.TargetParameterCountException | The parameters array does not have the correct number of arguments. |
T:System.Reflection.TargetInvocationException | The invoked method or constructor throws an exception. |
T:System.MethodAccessException | The caller does not have permission to execute the method or constructor that is represented by the current instance. |
T:System.InvalidOperationException | The type that declares the method is an open generic type. That is, the P:System.Type.ContainsGenericParameters property returns true for the declaring type. |
Implements System.Runtime.InteropServices._MethodBase.
Implemented in System.Reflection.Emit.DynamicMethod, System.Reflection.Emit.MethodBuilder, and System.Reflection.Emit.ConstructorBuilder.
object System.Reflection.MethodBase.Invoke | ( | object | obj, |
object [] | parameters | ||
) |
Invokes the method or constructor represented by the current instance, using the specified parameters.
obj | The object on which to invoke the method or constructor. If a method is static, this argument is ignored. If a constructor is static, this argument must be null or an instance of the class that defines the constructor. |
parameters | An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, parameters should be null .If the method or constructor represented by this instance takes a ref parameter (ByRef in Visual Basic), no special attribute is required for that parameter in order to invoke the method or constructor using this function. Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is null . For value-type elements, this value is 0, 0.0, or false , depending on the specific element type. |
null
in the case of a constructor.Elements of the parameters array that represent parameters declared with the ref
or out
keyword may also be modified.T:System.Reflection.TargetException | In the .NET for Windows Store apps or the Portable Class Library, catch T:System.Exception instead.The obj parameter is null and the method is not static.-or- The method is not declared or inherited by the class of obj . -or-A static constructor is invoked, and obj is neither null nor an instance of the class that declared the constructor. |
T:System.ArgumentException | The elements of the parameters array do not match the signature of the method or constructor reflected by this instance. |
T:System.Reflection.TargetInvocationException | The invoked method or constructor throws an exception. -or- The current instance is a T:System.Reflection.Emit.DynamicMethod that contains unverifiable code. See the "Verification" section in Remarks for T:System.Reflection.Emit.DynamicMethod. |
T:System.Reflection.TargetParameterCountException | The parameters array does not have the correct number of arguments. |
T:System.MethodAccessException | In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.MemberAccessException, instead.The caller does not have permission to execute the method or constructor that is represented by the current instance. |
T:System.InvalidOperationException | The type that declares the method is an open generic type. That is, the P:System.Type.ContainsGenericParameters property returns true for the declaring type. |
T:System.NotSupportedException | The current instance is a T:System.Reflection.Emit.MethodBuilder. |
Implements System.Runtime.InteropServices._MethodBase.
Definition at line 621 of file MethodBase.cs.
|
static |
Indicates whether two T:System.Reflection.MethodBase objects are not equal.
left | The first object to compare. |
right | The second object to compare. |
true
if left is not equal to right ; otherwise, false
.Definition at line 536 of file MethodBase.cs.
|
static |
Indicates whether two T:System.Reflection.MethodBase objects are equal.
left | The first object to compare. |
right | The second object to compare. |
true
if left is equal to right ; otherwise, false
.Definition at line 505 of file MethodBase.cs.
|
get |
Gets the attributes associated with this method.
Definition at line 55 of file MethodBase.cs.
|
get |
Gets a value indicating the calling conventions for this method.
Definition at line 64 of file MethodBase.cs.
|
get |
Gets a value indicating whether the generic method contains unassigned generic type parameters.
true
if the current T:System.Reflection.MethodBase object represents a generic method that contains unassigned generic type parameters; otherwise, false
.Definition at line 90 of file MethodBase.cs.
|
get |
Gets a value indicating whether the method is abstract.
true
if the method is abstract; otherwise, false
.Definition at line 279 of file MethodBase.cs.
|
get |
Gets a value indicating whether the potential visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.Assembly; that is, the method or constructor is visible at most to other types in the same assembly, and is not visible to derived types outside the assembly.
true
if the visibility of this method or constructor is exactly described by F:System.Reflection.MethodAttributes.Assembly; otherwise, false
.Definition at line 188 of file MethodBase.cs.
|
get |
Gets a value indicating whether the method is a constructor.
true
if this method is a constructor represented by a T:System.Reflection.ConstructorInfo object (see note in Remarks about T:System.Reflection.Emit.ConstructorBuilder objects); otherwise, false
.Definition at line 306 of file MethodBase.cs.
|
get |
Gets a value indicating whether the visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.Family; that is, the method or constructor is visible only within its class and derived classes.
true
if access to this method or constructor is exactly described by F:System.Reflection.MethodAttributes.Family; otherwise, false
.Definition at line 175 of file MethodBase.cs.
|
get |
Gets a value indicating whether the visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.FamANDAssem; that is, the method or constructor can be called by derived classes, but only if they are in the same assembly.
true
if access to this method or constructor is exactly described by F:System.Reflection.MethodAttributes.FamANDAssem; otherwise, false
.Definition at line 201 of file MethodBase.cs.
|
get |
Gets a value indicating whether the potential visibility of this method or constructor is described by F:System.Reflection.MethodAttributes.FamORAssem; that is, the method or constructor can be called by derived classes wherever they are, and by classes in the same assembly.
true
if access to this method or constructor is exactly described by F:System.Reflection.MethodAttributes.FamORAssem; otherwise, false
.Definition at line 214 of file MethodBase.cs.
|
get |
Gets a value indicating whether this method is final
.
true
if this method is final
; otherwise, false
.Definition at line 240 of file MethodBase.cs.
|
get |
Gets a value indicating whether the method is generic.
true
if the current T:System.Reflection.MethodBase represents a generic method; otherwise, false
.Definition at line 103 of file MethodBase.cs.
|
get |
Gets a value indicating whether the method is a generic method definition.
true
if the current T:System.Reflection.MethodBase object represents the definition of a generic method; otherwise, false
.Definition at line 77 of file MethodBase.cs.
|
get |
Gets a value indicating whether only a member of the same kind with exactly the same signature is hidden in the derived class.
true
if the member is hidden by signature; otherwise, false
.Definition at line 266 of file MethodBase.cs.
|
get |
Gets a value indicating whether this member is private.
true
if access to this method is restricted to other members of the class itself; otherwise, false
.Definition at line 162 of file MethodBase.cs.
|
get |
Gets a value indicating whether this is a public method.
true
if this method is public; otherwise, false
.Definition at line 149 of file MethodBase.cs.
|
get |
Gets a value that indicates whether the current method or constructor is security-critical or security-safe-critical at the current trust level, and therefore can perform critical operations.
true
if the current method or constructor is security-critical or security-safe-critical at the current trust level; false
if it is transparent. Definition at line 115 of file MethodBase.cs.
|
get |
Gets a value that indicates whether the current method or constructor is security-safe-critical at the current trust level; that is, whether it can perform critical operations and can be accessed by transparent code.
true
if the method or constructor is security-safe-critical at the current trust level; false
if it is security-critical or transparent.Definition at line 126 of file MethodBase.cs.
|
get |
Gets a value that indicates whether the current method or constructor is transparent at the current trust level, and therefore cannot perform critical operations.
true
if the method or constructor is security-transparent at the current trust level; otherwise, false
.Definition at line 137 of file MethodBase.cs.
|
get |
Gets a value indicating whether this method has a special name.
true
if this method has a special name; otherwise, false
.Definition at line 292 of file MethodBase.cs.
|
get |
Gets a value indicating whether the method is static
.
true
if this method is static
; otherwise, false
.Definition at line 227 of file MethodBase.cs.
|
get |
Gets a value indicating whether the method is virtual
.
true
if this method is virtual
; otherwise, false
.Definition at line 253 of file MethodBase.cs.
|
get |
Gets a handle to the internal metadata representation of a method.
Definition at line 46 of file MethodBase.cs.
|
get |
Gets the T:System.Reflection.MethodImplAttributes flags that specify the attributes of a method implementation.
Definition at line 34 of file MethodBase.cs.