Export (0) Print
Expand All

Delegate Constructor (Type, String)

Updated: June 2010

Initializes a delegate that invokes the specified static method from the specified class.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Protected Sub New ( _
	target As Type, _
	method As String _
)
'Usage
Dim target As Type 
Dim method As String 

Dim instance As New [Delegate](target, _
	method)

Parameters

target
Type: System.Type

The Type representing the class that defines method.

method
Type: System.String

The name of the static method that the delegate represents.

ExceptionCondition
ArgumentNullException

target is Nothing.

-or-

method is Nothing.

ArgumentException

target is not a RuntimeType. See Runtime Types in Reflection.

-or-

target represents an open generic type.

This constructor cannot be used in application code. To create a delegate by specifying the name of a static method, use an overload of the CreateDelegate method that specifies a method name but does not specify a target object. For example, the CreateDelegate method overload creates a static delegate for a method with a specified name.

This constructor creates delegates for static methods only. An instance method is a method that is associated with an instance of a class; a static method is a method that is associated with the class itself.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Date

History

Reason

June 2010

Clarified that this constructor is not used in application code.

Customer feedback.

Community Additions

ADD
Show:
© 2014 Microsoft