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
sourceTDelegateThe source delegate.
valueTDelegateThe delegate to combine with the source delegate.
Returns
- TDelegate
 A combined delegate of type TDelegate.
Type Parameters
TDelegateThe 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
methodMethodInfoThe method information.
Returns
- TDelegate
 A delegate of type TDelegate.
Type Parameters
TDelegateThe 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
methodMethodInfoThe method information.
instanceTInstanceThe instance on which the method is invoked.
Returns
- TDelegate
 A delegate of type TDelegate bound to the specified instance.
Type Parameters
TInstanceThe type of the instance.
TDelegateThe 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
actionActionThe 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
delegateTDelegateThe delegate whose invocation list is retrieved.
Returns
- IEnumerable<TDelegate>
 An IEnumerable of TDelegate representing the invocation list.
Type Parameters
TDelegateThe 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
handlerPropertyChangedEventHandlerThe PropertyChangedEventHandler to invoke.
senderobjectThe sender object.
namestringThe 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
handlerPropertyChangingEventHandlerThe PropertyChangingEventHandler to invoke.
senderobjectThe sender object.
namestringThe 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
sourceTDelegateThe delegate from which all delegates are removed.
Type Parameters
TDelegateThe 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
sourceTDelegateThe source delegate.
valueTDelegateThe delegate to remove from the source.
Returns
- TDelegate
 The resulting delegate of type TDelegate after removal.
Type Parameters
TDelegateThe type of the delegate.