Class DelegateHelper
Provides helper methods for working with delegates.
public static class DelegateHelper- Inheritance
- 
      
      DelegateHelper
- Inherited Members
Methods
AddDelegate<TDelegate>(TDelegate, TDelegate)
Combines two delegates of the same type.
public static TDelegate AddDelegate<TDelegate>(this TDelegate source, TDelegate value)Parameters
- sourceTDelegate
- The source delegate. 
- valueTDelegate
- The delegate to combine with the source delegate. 
Returns
- TDelegate
- A combined delegate of type TDelegate. 
Type Parameters
- TDelegate
- The type of the delegate. 
CreateDelegate<TDelegate>(MethodInfo)
Creates a delegate of type TDelegate for the specified method.
public static TDelegate CreateDelegate<TDelegate>(this MethodInfo method)Parameters
- methodMethodInfo
- The method information. 
Returns
- TDelegate
- A delegate of type TDelegate. 
Type Parameters
- TDelegate
- The type of delegate to create. 
CreateDelegate<TInstance, TDelegate>(MethodInfo, TInstance)
Creates a delegate of type TDelegate for the specified method and instance.
public static TDelegate CreateDelegate<TInstance, TDelegate>(this MethodInfo method, TInstance instance)Parameters
- methodMethodInfo
- The method information. 
- instanceTInstance
- The instance on which the method is invoked. 
Returns
- TDelegate
- A delegate of type TDelegate bound to the specified instance. 
Type Parameters
- TInstance
- The type of the instance. 
- TDelegate
- The type of delegate to create. 
Do(Action, Action<Exception>)
Executes the specified action and handles any exception using the provided error action.
public static void Do(this Action action, Action<Exception> error)Parameters
Exceptions
- ArgumentNullException
- Thrown when action or error is null. 
DoAsync(Action, Action<Exception>)
Executes the specified action asynchronously and handles any exception using the provided error action.
public static void DoAsync(this Action action, Action<Exception> error)Parameters
- actionAction
- The action to execute asynchronously. 
- errorAction<Exception>
- The action to handle exceptions. 
Exceptions
- ArgumentNullException
- Thrown when action or error is null. 
GetInvocationList<TDelegate>(TDelegate)
Returns an enumerable collection of delegates from the delegate's invocation list.
public static IEnumerable<TDelegate> GetInvocationList<TDelegate>(this TDelegate @delegate)Parameters
- delegateTDelegate
- The delegate whose invocation list is retrieved. 
Returns
- IEnumerable<TDelegate>
- An IEnumerable of TDelegate representing the invocation list. 
Type Parameters
- TDelegate
- The type of the delegate. 
Invoke(PropertyChangedEventHandler, object, string)
Invokes the PropertyChangedEventHandler with the specified sender and property name.
public static void Invoke(this PropertyChangedEventHandler handler, object sender, string name)Parameters
- handlerPropertyChangedEventHandler
- The PropertyChangedEventHandler to invoke. 
- senderobject
- The sender object. 
- namestring
- The name of the property that changed. 
Invoke(PropertyChangingEventHandler, object, string)
Invokes the PropertyChangingEventHandler with the specified sender and property name.
public static void Invoke(this PropertyChangingEventHandler handler, object sender, string name)Parameters
- handlerPropertyChangingEventHandler
- The PropertyChangingEventHandler to invoke. 
- senderobject
- The sender object. 
- namestring
- The name of the property that is changing. 
RemoveAllDelegates<TDelegate>(TDelegate)
Removes all invocation entries from the delegate.
public static void RemoveAllDelegates<TDelegate>(this TDelegate source)Parameters
- sourceTDelegate
- The delegate from which all delegates are removed. 
Type Parameters
- TDelegate
- The type of the delegate. 
RemoveDelegate<TDelegate>(TDelegate, TDelegate)
Removes the specified delegate from the source delegate.
public static TDelegate RemoveDelegate<TDelegate>(this TDelegate source, TDelegate value)Parameters
- sourceTDelegate
- The source delegate. 
- valueTDelegate
- The delegate to remove from the source. 
Returns
- TDelegate
- The resulting delegate of type TDelegate after removal. 
Type Parameters
- TDelegate
- The type of the delegate.