Delegate.Delegate(Type, String) Constructor

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

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

protected Delegate (
	Type target,
	string method
)
protected Delegate (
	Type target, 
	String method
)
protected function Delegate (
	target : Type, 
	method : String
)
Not applicable.

Parameters

target

The Type representing the class that defines method.

method

The name of the static method that the delegate represents.

Exception typeCondition

ArgumentNullException

target is a null reference (Nothing in Visual Basic).

-or-

method is a null reference (Nothing in Visual Basic).

ArgumentException

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

-or-

target represents an open generic type.

This constructor is called by a compiler-generated delegate type to create a delegate based on the name of a static method and the Type representing the class that defines that method.

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.

To get the Type that represents a class, use the Type.GetType method with the fully qualified (including namespace) name of the class. For example, passing "System.Threading.ThreadStart" to Type.GetType returns a Type for the ThreadStart class.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

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