mscorlib(4.0.0.0) API with additions
|
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. More...
Public Member Functions | |
object | DynamicInvoke (params object[] args) |
Dynamically invokes (late-bound) the method represented by the current delegate. More... | |
override bool | Equals (object obj) |
Determines whether the specified object and the current delegate are of the same type and share the same targets, methods, and invocation list. More... | |
override int | GetHashCode () |
Returns a hash code for the delegate. More... | |
virtual Delegate [] | GetInvocationList () |
Returns the invocation list of the delegate. More... | |
virtual object | Clone () |
Creates a shallow copy of the delegate. More... | |
virtual void | GetObjectData (SerializationInfo info, StreamingContext context) |
Not supported. More... | |
Static Public Member Functions | |
static Delegate | Combine (Delegate a, Delegate b) |
Concatenates the invocation lists of two delegates. More... | |
static Delegate | Combine (params Delegate[] delegates) |
Concatenates the invocation lists of an array of delegates. More... | |
static Delegate | Remove (Delegate source, Delegate value) |
Removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate. More... | |
static Delegate | RemoveAll (Delegate source, Delegate value) |
Removes all occurrences of the invocation list of a delegate from the invocation list of another delegate. More... | |
static Delegate | CreateDelegate (Type type, object target, string method) |
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance. More... | |
static Delegate | CreateDelegate (Type type, object target, string method, bool ignoreCase) |
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance with the specified case-sensitivity. More... | |
static Delegate | CreateDelegate (Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure) |
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance, with the specified case-sensitivity and the specified behavior on failure to bind. More... | |
static Delegate | CreateDelegate (Type type, Type target, string method) |
Creates a delegate of the specified type that represents the specified static method of the specified class. More... | |
static Delegate | CreateDelegate (Type type, Type target, string method, bool ignoreCase) |
Creates a delegate of the specified type that represents the specified static method of the specified class, with the specified case-sensitivity. More... | |
static Delegate | CreateDelegate (Type type, Type target, string method, bool ignoreCase, bool throwOnBindFailure) |
Creates a delegate of the specified type that represents the specified static method of the specified class, with the specified case-sensitivity and the specified behavior on failure to bind. More... | |
static Delegate | CreateDelegate (Type type, MethodInfo method, bool throwOnBindFailure) |
Creates a delegate of the specified type to represent the specified static method, with the specified behavior on failure to bind. More... | |
static Delegate | CreateDelegate (Type type, object firstArgument, MethodInfo method) |
Creates a delegate of the specified type that represents the specified static or instance method, with the specified first argument. More... | |
static Delegate | CreateDelegate (Type type, object firstArgument, MethodInfo method, bool throwOnBindFailure) |
Creates a delegate of the specified type that represents the specified static or instance method, with the specified first argument and the specified behavior on failure to bind. More... | |
static bool | operator== (Delegate d1, Delegate d2) |
Determines whether the specified delegates are equal. More... | |
static bool | operator != (Delegate d1, Delegate d2) |
Determines whether the specified delegates are not equal. More... | |
static Delegate | CreateDelegate (Type type, MethodInfo method) |
Creates a delegate of the specified type to represent the specified static method. More... | |
Protected Member Functions | |
Delegate (object target, string method) | |
Initializes a delegate that invokes the specified instance method on the specified class instance. More... | |
Delegate (Type target, string method) | |
Initializes a delegate that invokes the specified static method from the specified class. More... | |
virtual object | DynamicInvokeImpl (object[] args) |
Dynamically invokes (late-bound) the method represented by the current delegate. More... | |
virtual MethodInfo | GetMethodImpl () |
Gets the static method represented by the current delegate. More... | |
virtual Delegate | CombineImpl (Delegate d) |
Concatenates the invocation lists of the specified multicast (combinable) delegate and the current multicast (combinable) delegate. More... | |
virtual Delegate | RemoveImpl (Delegate d) |
Removes the invocation list of a delegate from the invocation list of another delegate. More... | |
Properties | |
MethodInfo | Method [get] |
Gets the method represented by the delegate. More... | |
object | Target [get] |
Gets the class instance on which the current delegate invokes the instance method. More... | |
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.
Definition at line 15 of file Delegate.cs.
|
protected |
Initializes a delegate that invokes the specified instance method on the specified class instance.
target | The class instance on which the delegate invokes method . |
method | The name of the instance method that the delegate represents. |
T:System.ArgumentNullException | target is null .-or- method is null . |
T:System.ArgumentException | There was an error binding to the target method. |
Definition at line 62 of file Delegate.cs.
|
protected |
Initializes a delegate that invokes the specified static method from the specified class.
target | The T:System.Type representing the class that defines method . |
method | The name of the static method that the delegate represents. |
T:System.ArgumentNullException | target is null .-or- method is null . |
T:System.ArgumentException | target is not a RuntimeType . See Runtime Types in Reflection.-or- target represents an open generic type. |
Definition at line 88 of file Delegate.cs.
|
virtual |
Creates a shallow copy of the delegate.
Implements System.ICloneable.
Definition at line 347 of file Delegate.cs.
Concatenates the invocation lists of two delegates.
a | The delegate whose invocation list comes first. |
b | The delegate whose invocation list comes last. |
null
, returns b if a is a null reference, and returns a null reference if both a and b are null references.T:System.ArgumentException | Both a and b are not null , and a and b are not instances of the same delegate type. |
Definition at line 202 of file Delegate.cs.
Concatenates the invocation lists of an array of delegates.
delegates | The array of delegates to combine. |
null
if delegates is null
, if delegates contains zero elements, or if every entry in delegates is null
.T:System.ArgumentException | Not all the non-null entries in delegates are instances of the same delegate type. |
Definition at line 217 of file Delegate.cs.
Concatenates the invocation lists of the specified multicast (combinable) delegate and the current multicast (combinable) delegate.
d | The multicast (combinable) delegate whose invocation list to append to the end of the invocation list of the current multicast (combinable) delegate. |
null
.T:System.MulticastNotSupportedException | Always thrown. |
Reimplemented in System.MulticastDelegate.
Definition at line 327 of file Delegate.cs.
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance.
type | The T:System.Type of delegate to create. |
target | The class instance on which method is invoked. |
method | The name of the instance method that the delegate is to represent. |
T:System.ArgumentNullException | type is null .-or- target is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate. -or- type is not a RuntimeType . See Runtime Types in Reflection.-or- method is not an instance method. -or- method cannot be bound, for example because it cannot be found. |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 368 of file Delegate.cs.
|
static |
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance with the specified case-sensitivity.
type | The T:System.Type of delegate to create. |
target | The class instance on which method is invoked. |
method | The name of the instance method that the delegate is to represent. |
ignoreCase | A Boolean indicating whether to ignore the case when comparing the name of the method. |
T:System.ArgumentNullException | type is null .-or- target is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection.-or- method is not an instance method. -or- method cannot be bound, for example because it cannot be found. |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 390 of file Delegate.cs.
|
static |
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance, with the specified case-sensitivity and the specified behavior on failure to bind.
type | The T:System.Type of delegate to create. |
target | The class instance on which method is invoked. |
method | The name of the instance method that the delegate is to represent. |
ignoreCase | A Boolean indicating whether to ignore the case when comparing the name of the method. |
throwOnBindFailure | true to throw an exception if method cannot be bound; otherwise, false . |
T:System.ArgumentNullException | type is null .-or- target is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- |
method is not an instance method. -or- method cannot be bound, for example because it cannot be found, and throwOnBindFailure is true
.
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 415 of file Delegate.cs.
Creates a delegate of the specified type that represents the specified static method of the specified class.
type | The T:System.Type of delegate to create. |
target | The T:System.Type representing the class that implements method . |
method | The name of the static method that the delegate is to represent. |
T:System.ArgumentNullException | type is null .-or- target is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- target is not a RuntimeType .-or- target is an open generic type. That is, its P:System.Type.ContainsGenericParameters property is true .-or- method is not a static method (Shared method in Visual Basic). -or- method cannot be bound, for example because it cannot be found, and throwOnBindFailure is true . |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 468 of file Delegate.cs.
|
static |
Creates a delegate of the specified type that represents the specified static method of the specified class, with the specified case-sensitivity.
type | The T:System.Type of delegate to create. |
target | The T:System.Type representing the class that implements method . |
method | The name of the static method that the delegate is to represent. |
ignoreCase | A Boolean indicating whether to ignore the case when comparing the name of the method. |
T:System.ArgumentNullException | type is null .-or- target is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- target is not a RuntimeType .-or- target is an open generic type. That is, its P:System.Type.ContainsGenericParameters property is true .-or- method is not a static method (Shared method in Visual Basic). -or- method cannot be bound, for example because it cannot be found. |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 492 of file Delegate.cs.
|
static |
Creates a delegate of the specified type that represents the specified static method of the specified class, with the specified case-sensitivity and the specified behavior on failure to bind.
type | The T:System.Type of delegate to create. |
target | The T:System.Type representing the class that implements method . |
method | The name of the static method that the delegate is to represent. |
ignoreCase | A Boolean indicating whether to ignore the case when comparing the name of the method. |
throwOnBindFailure | true to throw an exception if method cannot be bound; otherwise, false . |
T:System.ArgumentNullException | type is null .-or- target is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- target is not a RuntimeType .-or- target is an open generic type. That is, its P:System.Type.ContainsGenericParameters property is true .-or- method is not a static method (Shared method in Visual Basic). -or- method cannot be bound, for example because it cannot be found, and throwOnBindFailure is true . |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 519 of file Delegate.cs.
|
static |
Creates a delegate of the specified type to represent the specified static method, with the specified behavior on failure to bind.
type | The T:System.Type of delegate to create. |
method | The T:System.Reflection.MethodInfo describing the static or instance method the delegate is to represent. |
throwOnBindFailure | true to throw an exception if method cannot be bound; otherwise, false . |
T:System.ArgumentNullException | type is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- method cannot be bound, and throwOnBindFailure is true .-or- method is not a RuntimeMethodInfo . See Runtime Types in Reflection. |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 581 of file Delegate.cs.
|
static |
Creates a delegate of the specified type that represents the specified static or instance method, with the specified first argument.
type | The T:System.Type of delegate to create. |
firstArgument | The object to which the delegate is bound, or null to treat method as static (Shared in Visual Basic). |
method | The T:System.Reflection.MethodInfo describing the static or instance method the delegate is to represent. |
T:System.ArgumentNullException | type is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- method cannot be bound.-or- method is not a RuntimeMethodInfo . See Runtime Types in Reflection. |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 630 of file Delegate.cs.
|
static |
Creates a delegate of the specified type that represents the specified static or instance method, with the specified first argument and the specified behavior on failure to bind.
type | A T:System.Type representing the type of delegate to create. |
firstArgument | An T:System.Object that is the first argument of the method the delegate represents. For instance methods, it must be compatible with the instance type. |
method | The T:System.Reflection.MethodInfo describing the static or instance method the delegate is to represent. |
throwOnBindFailure | true to throw an exception if method cannot be bound; otherwise, false . |
null
if throwOnBindFailure is false
and the delegate cannot be bound to method . T:System.ArgumentNullException | type is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- method cannot be bound, and throwOnBindFailure is true .-or- method is not a RuntimeMethodInfo . See Runtime Types in Reflection. |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 654 of file Delegate.cs.
|
static |
Creates a delegate of the specified type to represent the specified static method.
type | The T:System.Type of delegate to create. |
method | The T:System.Reflection.MethodInfo describing the static or instance method the delegate is to represent. Only static methods are supported in the .NET Framework version 1.0 and 1.1. |
T:System.ArgumentNullException | type is null .-or- method is null . |
T:System.ArgumentException | type does not inherit T:System.MulticastDelegate.-or- type is not a RuntimeType . See Runtime Types in Reflection. -or- method is not a static method, and the .NET Framework version is 1.0 or 1.1. -or- method cannot be bound.-or- method is not a RuntimeMethodInfo . See Runtime Types in Reflection. |
T:System.MissingMethodException | The Invoke method of type is not found. |
T:System.MethodAccessException | The caller does not have the permissions necessary to access method . |
Definition at line 795 of file Delegate.cs.
object System.Delegate.DynamicInvoke | ( | params object [] | args | ) |
Dynamically invokes (late-bound) the method represented by the current delegate.
args | An array of objects that are the arguments to pass to the method represented by the current delegate.-or- null , if the method represented by the current delegate does not require arguments. |
T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private).-or- The number, order, or type of parameters listed in args is invalid. |
T:System.ArgumentException | The method represented by the delegate is invoked on an object or a class that does not support it. |
T:System.Reflection.TargetInvocationException | The method represented by the delegate is an instance method and the target object is null .-or- One of the encapsulated methods throws an exception. |
Definition at line 122 of file Delegate.cs.
|
protectedvirtual |
Dynamically invokes (late-bound) the method represented by the current delegate.
args | An array of objects that are the arguments to pass to the method represented by the current delegate.-or- null , if the method represented by the current delegate does not require arguments. |
T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private).-or- The number, order, or type of parameters listed in args is invalid. |
T:System.ArgumentException | The method represented by the delegate is invoked on an object or a class that does not support it. |
T:System.Reflection.TargetInvocationException | The method represented by the delegate is an instance method and the target object is null .-or- One of the encapsulated methods throws an exception. |
Definition at line 135 of file Delegate.cs.
override bool System.Delegate.Equals | ( | object | obj | ) |
Determines whether the specified object and the current delegate are of the same type and share the same targets, methods, and invocation list.
obj | The object to compare with the current delegate. |
true
if obj and the current delegate have the same targets, methods, and invocation list; otherwise, false
.T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private). |
Definition at line 148 of file Delegate.cs.
override int System.Delegate.GetHashCode | ( | ) |
Returns a hash code for the delegate.
Definition at line 191 of file Delegate.cs.
|
virtual |
Returns the invocation list of the delegate.
Reimplemented in System.MulticastDelegate.
Definition at line 234 of file Delegate.cs.
|
protectedvirtual |
Gets the static method represented by the current delegate.
T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private). |
Reimplemented in System.MulticastDelegate.
Definition at line 246 of file Delegate.cs.
|
virtual |
Not supported.
info | Not supported. |
context | Not supported. |
T:System.NotSupportedException | This method is not supported. |
Implements System.Runtime.Serialization.ISerializable.
Reimplemented in System.MulticastDelegate.
Definition at line 718 of file Delegate.cs.
Determines whether the specified delegates are not equal.
d1 | The first delegate to compare. |
d2 | The second delegate to compare. |
true
if d1 is not equal to d2 ; otherwise, false
.Definition at line 704 of file Delegate.cs.
Determines whether the specified delegates are equal.
d1 | The first delegate to compare. |
d2 | The second delegate to compare. |
true
if d1 is equal to d2 ; otherwise, false
.Definition at line 693 of file Delegate.cs.
Removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate.
source | The delegate from which to remove the invocation list of value . |
value | The delegate that supplies the invocation list to remove from the invocation list of source . |
null
or if the invocation list of value is not found within the invocation list of source . Returns a null reference if the invocation list of value is equal to the invocation list of source or if source is a null reference.T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private). |
T:System.ArgumentException | The delegate types do not match. |
Definition at line 287 of file Delegate.cs.
Removes all occurrences of the invocation list of a delegate from the invocation list of another delegate.
source | The delegate from which to remove the invocation list of value . |
value | The delegate that supplies the invocation list to remove from the invocation list of source . |
null
or if the invocation list of value is not found within the invocation list of source . Returns a null reference if the invocation list of value is equal to the invocation list of source , if source contains only a series of invocation lists that are equal to the invocation list of value , or if source is a null reference.T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private). |
T:System.ArgumentException | The delegate types do not match. |
Definition at line 311 of file Delegate.cs.
Removes the invocation list of a delegate from the invocation list of another delegate.
d | The delegate that supplies the invocation list to remove from the invocation list of the current delegate. |
null
or if the invocation list of value is not found within the current delegate's invocation list. Returns null
if the invocation list of value is equal to the current delegate's invocation list.T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private). |
Reimplemented in System.MulticastDelegate.
Definition at line 336 of file Delegate.cs.
|
get |
Gets the method represented by the delegate.
T:System.MemberAccessException | The caller does not have access to the method represented by the delegate (for example, if the method is private). |
Definition at line 34 of file Delegate.cs.
|
get |
Gets the class instance on which the current delegate invokes the instance method.
null
if the delegate represents a static method.Definition at line 46 of file Delegate.cs.