Class Func
Provides extension methods for delegate
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class Func : object
Methods
| Improve this Doc View SourceAsConverter<I, O>(Func<I, O>)
Converts
Declaration
public static Converter<I, O> AsConverter<I, O>(this Func<I, O> function)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<I, O> | function | The function to convert. |
Returns
Type | Description |
---|---|
DotNext.Converter<I, O> | A delegate of type |
Type Parameters
Name | Description |
---|---|
I | Type of input argument. |
O | Return type of the converter. |
AsPredicate<T>(Func<T, Boolean>)
Converts
Declaration
public static Predicate<T> AsPredicate<T>(this Func<T, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T, Boolean> | predicate | A delegate to convert. |
Returns
Type | Description |
---|---|
DotNext.Predicate<T> | A delegate of type |
Type Parameters
Name | Description |
---|---|
T | Type of predicate argument. |
Identity<T>()
The converter which returns input argument without any modifications.
Declaration
public static Func<T, T> Identity<T>()
Returns
Type | Description |
---|---|
DotNext.Func<T, T> | The identity function. |
Type Parameters
Name | Description |
---|---|
T | Type of input and output. |
Remarks
This method returns the same instance of predicate on every call.
Identity<I, O>()
The function which returns input argument without any modifications.
Declaration
public static Func<I, O> Identity<I, O>()
where I : O
Returns
Type | Description |
---|---|
DotNext.Func<I, O> | The identity function. |
Type Parameters
Name | Description |
---|---|
I | Type of input. |
O | Type of output. |
Remarks
This method returns the same instance of predicate on every call.
IsNotNull<T>()
Returns predicate checking that input argument is not null.
Declaration
public static Func<T, bool> IsNotNull<T>()
where T : class
Returns
Type | Description |
---|---|
DotNext.Func<T, Boolean> | The predicate instance. |
Type Parameters
Name | Description |
---|---|
T | Type of the predicate argument. |
Remarks
This method returns the same instance of predicate on every call.
IsNull<T>()
Returns predicate implementing nullability check.
Declaration
public static Func<T, bool> IsNull<T>()
where T : class
Returns
Type | Description |
---|---|
DotNext.Func<T, Boolean> | The predicate instance. |
Type Parameters
Name | Description |
---|---|
T | Type of predicate argument. |
Remarks
This method returns the same instance of predicate on every call.
TryInvoke<R>(Func<R>)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<R>(this Func<R> function)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<R> | function | The function to invoke. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
R | The result type. |
TryInvoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>, T1, T2, T3, T4, T5, T6, T7, T8, T9)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> function, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
T4 | arg4 | The fourth function argument. |
T5 | arg5 | The fifth function argument. |
T6 | arg6 | The sixth function argument. |
T7 | arg7 | The seventh function argument. |
T8 | arg8 | The eighth function argument. |
T9 | arg9 | The ninth function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
T4 | The type of the fourth function argument. |
T5 | The type of the fifth function argument. |
T6 | The type of the sixth function argument. |
T7 | The type of the seventh function argument. |
T8 | The type of the eighth function argument. |
T9 | The type of the ninth function argument. |
R | The result type. |
TryInvoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R> function, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
T4 | arg4 | The fourth function argument. |
T5 | arg5 | The fifth function argument. |
T6 | arg6 | The sixth function argument. |
T7 | arg7 | The seventh function argument. |
T8 | arg8 | The eighth function argument. |
T9 | arg9 | The ninth function argument. |
T10 | arg10 | The tenth function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
T4 | The type of the fourth function argument. |
T5 | The type of the fifth function argument. |
T6 | The type of the sixth function argument. |
T7 | The type of the seventh function argument. |
T8 | The type of the eighth function argument. |
T9 | The type of the ninth function argument. |
T10 | The type of the tenth function argument. |
R | The result type. |
TryInvoke<T, R>(Func<T, R>, T)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T, R>(this Func<T, R> function, T arg)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T, R> | function | The function to invoke. |
T | arg | The first function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T | The type of the first function argument. |
R | The result type. |
TryInvoke<T1, T2, R>(Func<T1, T2, R>, T1, T2)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, R>(this Func<T1, T2, R> function, T1 arg1, T2 arg2)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
R | The result type. |
TryInvoke<T1, T2, T3, R>(Func<T1, T2, T3, R>, T1, T2, T3)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, R>(this Func<T1, T2, T3, R> function, T1 arg1, T2 arg2, T3 arg3)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
R | The result type. |
TryInvoke<T1, T2, T3, T4, R>(Func<T1, T2, T3, T4, R>, T1, T2, T3, T4)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, T4, R>(this Func<T1, T2, T3, T4, R> function, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, T4, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
T4 | arg4 | The fourth function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
T4 | The type of the fourth function argument. |
R | The result type. |
TryInvoke<T1, T2, T3, T4, T5, R>(Func<T1, T2, T3, T4, T5, R>, T1, T2, T3, T4, T5)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, T4, T5, R>(this Func<T1, T2, T3, T4, T5, R> function, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, T4, T5, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
T4 | arg4 | The fourth function argument. |
T5 | arg5 | The fifth function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
T4 | The type of the fourth function argument. |
T5 | The type of the fifth function argument. |
R | The result type. |
TryInvoke<T1, T2, T3, T4, T5, T6, R>(Func<T1, T2, T3, T4, T5, T6, R>, T1, T2, T3, T4, T5, T6)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, T4, T5, T6, R>(this Func<T1, T2, T3, T4, T5, T6, R> function, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, T4, T5, T6, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
T4 | arg4 | The fourth function argument. |
T5 | arg5 | The fifth function argument. |
T6 | arg6 | The sixth function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
T4 | The type of the fourth function argument. |
T5 | The type of the fifth function argument. |
T6 | The type of the sixth function argument. |
R | The result type. |
TryInvoke<T1, T2, T3, T4, T5, T6, T7, R>(Func<T1, T2, T3, T4, T5, T6, T7, R>, T1, T2, T3, T4, T5, T6, T7)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, T4, T5, T6, T7, R>(this Func<T1, T2, T3, T4, T5, T6, T7, R> function, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, T4, T5, T6, T7, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
T4 | arg4 | The fourth function argument. |
T5 | arg5 | The fifth function argument. |
T6 | arg6 | The sixth function argument. |
T7 | arg7 | The seventh function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
T4 | The type of the fourth function argument. |
T5 | The type of the fifth function argument. |
T6 | The type of the sixth function argument. |
T7 | The type of the seventh function argument. |
R | The result type. |
TryInvoke<T1, T2, T3, T4, T5, T6, T7, T8, R>(Func<T1, T2, T3, T4, T5, T6, T7, T8, R>, T1, T2, T3, T4, T5, T6, T7, T8)
Invokes function without throwing the exception.
Declaration
public static Result<R> TryInvoke<T1, T2, T3, T4, T5, T6, T7, T8, R>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, R> function, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
Parameters
Type | Name | Description |
---|---|---|
DotNext.Func<T1, T2, T3, T4, T5, T6, T7, T8, R> | function | The function to invoke. |
T1 | arg1 | The first function argument. |
T2 | arg2 | The second function argument. |
T3 | arg3 | The third function argument. |
T4 | arg4 | The fourth function argument. |
T5 | arg5 | The fifth function argument. |
T6 | arg6 | The sixth function argument. |
T7 | arg7 | The seventh function argument. |
T8 | arg8 | The eighth function argument. |
Returns
Type | Description |
---|---|
Result<R> | The invocation result. |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first function argument. |
T2 | The type of the second function argument. |
T3 | The type of the third function argument. |
T4 | The type of the fourth function argument. |
T5 | The type of the fifth function argument. |
T6 | The type of the sixth function argument. |
T7 | The type of the seventh function argument. |
T8 | The type of the eighth function argument. |
R | The result type. |