Class InvokeUtil
Utility class for method invocation operations.
public static class InvokeUtil
- Inheritance
-
InvokeUtil
- Inherited Members
Methods
SelfInvoke<TSrc>(TSrc, Action<TSrc>)
Invokes the specified action on the source object itself.
public static void SelfInvoke<TSrc>(this TSrc src, Action<TSrc> func)
Parameters
src
TSrcThe source object
func
Action<TSrc>The action to invoke on the source object
Type Parameters
TSrc
The type of the source object
SelfInvoke<TSrc, TDst>(TSrc, Func<TSrc, TDst>)
Invokes the specified function on the source object itself and returns the result. This function is usually used to apply a temporary variable, so that the property call is not computed twice.
public static TDst SelfInvoke<TSrc, TDst>(this TSrc src, Func<TSrc, TDst> func)
Parameters
src
TSrcThe source object
func
Func<TSrc, TDst>The function to invoke on the source object
Returns
- TDst
The result of the function invocation
Type Parameters
TSrc
The type of the source object
TDst
The type of the result