Match<TUnion, Type1, Type2, Type3, ReturnType>(IEnumerable<TUnion>, Func<Type1, ReturnType>, Func<Type2, ReturnType>, Func<Type3, ReturnType>) Method


Matches the specific types and uses the given functions to tranform into s ingle returntype.


public static IEnumerable<ReturnType> Match<TUnion, Type1, Type2, Type3, ReturnType>(this IEnumerable<TUnion> values, Func<Type1, ReturnType> Function1, Func<Type2, ReturnType> Function2, Func<Type3, ReturnType> Function3) 
    where TUnion : DiscriminatedUnion<Type1, Type2, Type3>

Type Parameters

Name Description
TUnion TUnion
Type1 Type1
Type2 Type2
Type3 Type3
ReturnType the returntype for all functions


Name Type Description
values IEnumerable<TUnion> existing Discriminated unions
Function1 Func<Type1, ReturnType> Function to run for Type1
Function2 Func<Type2, ReturnType> Function to run for Type2
Function3 Func<Type3, ReturnType> Function to run for Type3

Return Value

Type Description