Example #1
0
        public static TaggedUnion <TFirst, TSecond> OrInitialize <TFirst, TSecond>(
            this TaggedUnion <TFirst, TSecond> union,
            Func <TaggedUnion <TFirst, TSecond> > otherFactory)
        {
            _ = otherFactory ?? throw new ArgumentNullException(nameof(otherFactory));

            return(union.InternalOrInitialize(Pipeline.Pipe, otherFactory));
        }
Example #2
0
        public static ValueTask <TaggedUnion <TFirst, TSecond> > OrInitializeValueAsync <TFirst, TSecond>(
            this TaggedUnion <TFirst, TSecond> union,
            Func <ValueTask <TaggedUnion <TFirst, TSecond> > > otherFactoryAsync)
        {
            _ = otherFactoryAsync ?? throw new ArgumentNullException(nameof(otherFactoryAsync));

            return(union.InternalOrInitialize(ValueTask.FromResult, otherFactoryAsync));
        }