DiscriminatedUnionWithBaseList<Type1, Type2, Type3, Type4, Type5, Type6, BaseType> Class

Summary

Represents a list of Discriminated unions with a common baseclass. Using this list you can add items without having to specify the union type.
Namespace
FunctionalSharp.DiscriminatedUnions
Interfaces
  • IList<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>
  • ICollection<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>
  • IList
  • ICollection
  • IReadOnlyList<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>
  • IReadOnlyCollection<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>
  • IEnumerable<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>
  • IEnumerable
Base Types
  • object
  • List<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>
graph TD Base0["List<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>"]-->Type Base1["object"]-->Base0 Interface0["IList<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>"]-.->Type Interface1["ICollection<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>"]-.->Type Interface2["IList"]-.->Type Interface3["ICollection"]-.->Type Interface4["IReadOnlyList<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>"]-.->Type Interface5["IReadOnlyCollection<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>"]-.->Type Interface6["IEnumerable<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>"]-.->Type Interface7["IEnumerable"]-.->Type Type["DiscriminatedUnionWithBaseList<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>"] class Type type-node

Syntax

[Serializable]
public class DiscriminatedUnionWithBaseList<Type1, Type2, Type3, Type4, Type5, Type6, BaseType> : 
    List<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>, 
    IList<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>, 
    ICollection<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>, 
    IList, ICollection, 
    IReadOnlyList<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>, 
    
    IReadOnlyCollection<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>, 
    IEnumerable<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>, 
    IEnumerable
    
    where Type1 : BaseType where Type2 : BaseType where Type3 : BaseType where Type4 : BaseType where Type5 : BaseType where Type6 : BaseType

Attributes

Type Description
SerializableAttribute

Type Parameters

Name Description
Type1
Type2
Type3
Type4
Type5
Type6
BaseType

Methods

Name Value Summary
Add(Type1) void
Adds the object to the end of the DiscriminatedUnionList
Add(Type2) void
Adds the object to the end of the DiscriminatedUnionList
Add(Type3) void
Adds the object to the end of the DiscriminatedUnionList
Add(Type4) void
Adds the object to the end of the DiscriminatedUnionList
Add(Type5) void
Adds the object to the end of the DiscriminatedUnionList
Add(Type6) void
Adds the object to the end of the DiscriminatedUnionList
AddRange(IEnumerable<Type1>) void
Adds a Enumerable of items to the list.
AddRange(IEnumerable<Type2>) void
Adds a Enumerable of items to the list.
AddRange(IEnumerable<Type3>) void
Adds a Enumerable of items to the list.
AddRange(IEnumerable<Type4>) void
Adds a Enumerable of items to the list.
AddRange(IEnumerable<Type5>) void
Adds a Enumerable of items to the list.
AddRange(IEnumerable<Type6>) void
Adds a Enumerable of items to the list.
Merge<TypeToMerge>(IEnumerable<TypeToMerge>) DiscriminatedUnionWithBaseList<Type1, Type2, Type3, Type4, Type5, Type6, TypeToMerge, BaseType>
Merges a type into the existing discriminated union list.

Extension Methods

Name Value Summary
Match<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>() PatternMatchContext<T>
Starts a pattern match. Subsequent calls to With() need to be used to specify conditions
Match<DiscriminatedUnionWithBaseList<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>() PatternMatchSingleContext<T>
Starts a pattern match for a single value. Subsequent calls to With() need to be used to specify conditions
Match<Type1, Type2, Type3, Type4, Type5, Type6, BaseType, ReturnType>(Func<Type1, ReturnType>, Func<Type2, ReturnType>, Func<Type3, ReturnType>, Func<Type4, ReturnType>, Func<Type5, ReturnType>, Func<Type6, ReturnType>) IEnumerable<ReturnType>
Transforms the list matching the specific types and extecuting a function for them.
Match<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>(Action<Type1>, Action<Type2>, Action<Type3>, Action<Type4>, Action<Type5>, Action<Type6>) void
Runs actions for the specific matching types.
Match<Type1, Type2, Type3, Type4, Type5, Type6, ReturnType>(Func<Type1, ReturnType>, Func<Type2, ReturnType>, Func<Type3, ReturnType>, Func<Type4, ReturnType>, Func<Type5, ReturnType>, Func<Type6, ReturnType>) IEnumerable<ReturnType>
Matches the specific types and uses the given functions to tranform into s ingle returntype.
Match<Type1, Type2, Type3, Type4, Type5, Type6>(Action<Type1>, Action<Type2>, Action<Type3>, Action<Type4>, Action<Type5>, Action<Type6>) void
Matches the specific types and executes the given action for them.
MatchDiscriminated<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>() DiscriminatedPatternMatchContext<T>
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2, Type3, Type4, Type5, Type6, Type7, Type8, Type9>(IEnumerable<Type2>, IEnumerable<Type3>, IEnumerable<Type4>, IEnumerable<Type5>, IEnumerable<Type6>, IEnumerable<Type7>, IEnumerable<Type8>, IEnumerable<Type9>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8, Type9>>
Merges to given collections into a discriminated union collection.
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2, Type3, Type4, Type5, Type6, Type7, Type8>(IEnumerable<Type2>, IEnumerable<Type3>, IEnumerable<Type4>, IEnumerable<Type5>, IEnumerable<Type6>, IEnumerable<Type7>, IEnumerable<Type8>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8>>
Merges to given collections into a discriminated union collection.
Merge<Type1, Type2, Type3, Type4, Type5, Type6, Type7>(IEnumerable<Type7>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4, Type5, Type6, Type7>>
Merges the item intos the existing discriminatedunions resulting in a new enumerable of discriminated unions with the type of the items as a new option.
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2, Type3, Type4, Type5, Type6, Type7>(IEnumerable<Type2>, IEnumerable<Type3>, IEnumerable<Type4>, IEnumerable<Type5>, IEnumerable<Type6>, IEnumerable<Type7>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4, Type5, Type6, Type7>>
Merges to given collections into a discriminated union collection.
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2, Type3, Type4, Type5, Type6>(IEnumerable<Type2>, IEnumerable<Type3>, IEnumerable<Type4>, IEnumerable<Type5>, IEnumerable<Type6>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4, Type5, Type6>>
Merges to given collections into a discriminated union collection.
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2, Type3, Type4, Type5>(IEnumerable<Type2>, IEnumerable<Type3>, IEnumerable<Type4>, IEnumerable<Type5>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4, Type5>>
Merges to given collections into a discriminated union collection.
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2, Type3, Type4>(IEnumerable<Type2>, IEnumerable<Type3>, IEnumerable<Type4>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4>>
Merges to given collections into a discriminated union collection.
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2, Type3>(IEnumerable<Type2>, IEnumerable<Type3>) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3>>
Merges to given collections into a discriminated union collection.
Merge<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, Type2>(IEnumerable<Type2>) IEnumerable<DiscriminatedUnion<Type1, Type2>>
Merges to given collections into a discriminated union collection.
MergeItem<Type1, Type2, Type3, Type4, Type5, Type6, Type7>(Type7) IEnumerable<DiscriminatedUnion<Type1, Type2, Type3, Type4, Type5, Type6, Type7>>
Merges the item into the existing discriminatedunions resulting in a new enumerable of discriminated unions with the type of the item as a new option.
SafeSingle<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>(Func<DiscriminatedUnionWithBase<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>, bool>) DiscriminatedUnion<T, MultipleResultsException, EmptySequenceException>
provides a mechanism to use Single on a collection that returns a discriminated union instead of an exception.
ToOption<DiscriminatedUnionWithBaseList<Type1, Type2, Type3, Type4, Type5, Type6, BaseType>>() IOption<T>
Turns the type T into an option type.