Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Delegate
Assembly: System.Runtime
Inheritance: object → Delegate
Represents a delegate, which is a data structure that refers to a static method or to a class instance and an instance method of that class.
Properties
public
bool
HasSingleTarget
Gets a value that indicates whether the <see cref="T:System.Delegate" /> has a single invocation target.
public
MethodInfo
Method
Gets the method represented by the delegate.
public
object
Target
Gets the class instance on which the current delegate invokes the instance method.
Methods
public
object
Clone​() Returns A shallow copy of the delegate.
Creates a shallow copy of the delegate.
protected
delegate
CombineImpl​(delegate d)
d
The multicast (combinable) delegate whose invocation list to append to the end of the invocation list of the current multicast (combinable) delegate.
Returns A new multicast (combinable) delegate with an invocation list that concatenates the invocation list of the current multicast (combinable) delegate and the invocation list of <paramref name="d" /> , or the current multicast (combinable) delegate if <paramref name="d" /> is <see langword="null" /> .
Concatenates the invocation lists of the specified multicast (combinable) delegate and the current multicast (combinable) delegate.
public
object
DynamicInvoke​(object[] args)
args
An array of objects that are the arguments to pass to the method represented by the current delegate.
-or-
<see langword="null" /> , if the method represented by the current delegate does not require arguments.
Returns The object returned by the method represented by the delegate.
Dynamically invokes (late-bound) the method represented by the current delegate.
protected
object
DynamicInvokeImpl​(object[] args)
args
An array of objects that are the arguments to pass to the method represented by the current delegate.
-or-
<see langword="null" /> , if the method represented by the current delegate does not require arguments.
Returns The object returned by the method represented by the delegate.
Dynamically invokes (late-bound) the method represented by the current delegate.
public
bool
Equals​(object obj)
obj
The object to compare with the current delegate.
Returns <see langword="true" /> if <paramref name="obj" /> and the current delegate have the same targets, methods, and invocation list; otherwise, <see langword="false" /> .
Determines whether the specified object and the current delegate are of the same type and share the same targets, methods, and invocation list.
public
int
GetHashCode​() Returns A hash code for the delegate.
Returns a hash code for the delegate.
public
delegate[]
GetInvocationList​() Returns An array of delegates representing the invocation list of the current delegate.
Returns the invocation list of the delegate.
protected
MethodInfo
GetMethodImpl​() Returns A <see cref="T:System.Reflection.MethodInfo" /> describing the method represented by the current delegate.
Gets the method represented by the current delegate.
public
void
GetObjectData​(SerializationInfo info,
StreamingContext context)
info
Not supported.
context
Not supported.
Not supported.
protected
delegate
RemoveImpl​(delegate d)
d
The delegate that supplies the invocation list to remove from the invocation list of the current delegate.
Returns A new delegate with an invocation list formed by taking the invocation list of the current delegate and removing the invocation list of <paramref name="d" /> , if the invocation list of <paramref name="d" /> is found within the current delegate's invocation list. Returns the current delegate if <paramref name="d" /> is <see langword="null" /> or if the invocation list of <paramref name="d" /> is not found within the current delegate's invocation list. Returns <see langword="null" /> if the invocation list of <paramref name="d" /> is equal to the current delegate's invocation list.
Removes the invocation list of a delegate from the invocation list of another delegate.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.