Specifies a given method body that implements a given method declaration.
[Visual Basic] Public Sub DefineMethodOverride( _ ByVal methodInfoBody As MethodInfo, _ ByVal methodInfoDeclaration As MethodInfo _ ) [C#] public void DefineMethodOverride( MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration ); [C++] public: void DefineMethodOverride( MethodInfo* methodInfoBody, MethodInfo* methodInfoDeclaration ); [JScript] public function DefineMethodOverride( methodInfoBody : MethodInfo, methodInfoDeclaration : MethodInfo );
- The method body to be used. This should be a MethodBuilder object.
- The method whose declaration is to be used.
|ArgumentException||methodInfoBody does not belong to this class.|
|ArgumentNullException||methodInfoBody or methodInfoDeclaration is a null reference (Nothing in Visual Basic).|
|InvalidOperationException||The type was previously created using CreateType.
The method methodInfoBody 's declaring type is not this type.
DefineMethodOverride defines a method impl. A method impl is a token point to an implementation and a token pointing to a declaration that the body will implement. The body must be defined on the type the method impl is defined and the body must be virtual. The declaration can be made to a method defined on an interface implemented by the type, a method on a derived class or a method defined in the type. If the declaration is on an interface only, the slot defined for the interface is altered. If the declaration is made to a method on a base type then the slot for the method is overridden and any duplicates for the overridden method are also replaced. The method overridden cannot be the actual method declared. If the method is on the same type then the slot is replaced and any duplicates for the replaced methods are overridden.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family