예제 #1
0
        public static TUnionType Do <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour> > union, Action <TOne> one, Action <TTwo> two, Action <TThree> three, Action <TFour> four)
            where TUnionType : struct
            where TUnionDefinition : UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour>
        {
            if (one == null)
            {
                throw new ArgumentNullException(nameof(one));
            }

            if (two == null)
            {
                throw new ArgumentNullException(nameof(two));
            }

            if (three == null)
            {
                throw new ArgumentNullException(nameof(three));
            }

            if (four == null)
            {
                throw new ArgumentNullException(nameof(four));
            }

            union.Match(value => { one.Invoke(value); return(false); }, value => { two.Invoke(value); return(false); }, value => { three.Invoke(value); return(false); }, value => { four.Invoke(value); return(false); });

            return(union.AsUnion());
        }
예제 #2
0
        public static async Task <TUnionType> DoAsync <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven> > union, Func <TOne, Task> one, Func <TTwo, Task> two, Func <TThree, Task> three, Func <TFour, Task> four, Func <TFive, Task> five, Func <TSix, Task> six, Func <TSeven, Task> seven)
            where TUnionType : struct
            where TUnionDefinition : UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven>
        {
            await union.Match(one, two, three, four, five, six, seven);

            return(union.AsUnion());
        }
예제 #3
0
        public static async Task <TUnionType> DoAsync <TUnionType, TUnionDefinition, TOne>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne> > union, Func <TOne, Task> one)
            where TUnionType : struct
            where TUnionDefinition : UnionDefinitionBase <TUnionType, TUnionDefinition, TOne>
        {
            await union.Match(one);

            return(union.AsUnion());
        }
예제 #4
0
		public static async Task<TUnionType> DoAsync<TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour>(this IUnionValue<UnionDefinitionBase<TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour>> union, Func<TOne, Task> one, Func<TTwo, Task> two, Func<TThree, Task> three, Func<TFour, Task> four)
			where TUnionType : struct
			where TUnionDefinition : UnionDefinitionBase<TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour>
		{
			await union.Match(one, two, three, four);

			return union.AsUnion();
		}
예제 #5
0
        public static TUnionType Do <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven, TEight>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven, TEight> > union, Action <TOne> one, Action <TTwo> two, Action <TThree> three, Action <TFour> four, Action <TFive> five, Action <TSix> six, Action <TSeven> seven, Action <TEight> eight)
            where TUnionType : struct
            where TUnionDefinition : notnull, UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven, TEight>
            where TOne : notnull
            where TTwo : notnull
            where TThree : notnull
            where TFour : notnull
            where TFive : notnull
            where TSix : notnull
            where TSeven : notnull
            where TEight : notnull
        {
            if (one == null)
            {
                throw new ArgumentNullException(nameof(one));
            }

            if (two == null)
            {
                throw new ArgumentNullException(nameof(two));
            }

            if (three == null)
            {
                throw new ArgumentNullException(nameof(three));
            }

            if (four == null)
            {
                throw new ArgumentNullException(nameof(four));
            }

            if (five == null)
            {
                throw new ArgumentNullException(nameof(five));
            }

            if (six == null)
            {
                throw new ArgumentNullException(nameof(six));
            }

            if (seven == null)
            {
                throw new ArgumentNullException(nameof(seven));
            }

            if (eight == null)
            {
                throw new ArgumentNullException(nameof(eight));
            }

            union.Match(value => { one.Invoke(value); return(false); }, value => { two.Invoke(value); return(false); }, value => { three.Invoke(value); return(false); }, value => { four.Invoke(value); return(false); }, value => { five.Invoke(value); return(false); }, value => { six.Invoke(value); return(false); }, value => { seven.Invoke(value); return(false); }, value => { eight.Invoke(value); return(false); });

            return(union.AsUnion());
        }
예제 #6
0
        public static async Task <TUnionType> DoAsync <TUnionType, TUnionDefinition, TOne, TTwo>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo> > union, Func <TOne, Task> one, Func <TTwo, Task> two)
            where TUnionType : struct
            where TUnionDefinition : notnull, UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo>
            where TOne : notnull
            where TTwo : notnull
        {
            await union.Match(one, two);

            return(union.AsUnion());
        }
예제 #7
0
        public static TUnionType Do <TUnionType, TUnionDefinition, TOne>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne> > union, Action <TOne> one)
            where TUnionType : struct
            where TUnionDefinition : UnionDefinitionBase <TUnionType, TUnionDefinition, TOne>
        {
            if (one == null)
            {
                throw new ArgumentNullException(nameof(one));
            }

            union.Match(value => { one.Invoke(value); return(false); });

            return(union.AsUnion());
        }
예제 #8
0
        public static async Task <TUnionType> DoAsync <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive> > union, Func <TOne, Task> one, Func <TTwo, Task> two, Func <TThree, Task> three, Func <TFour, Task> four, Func <TFive, Task> five)
            where TUnionType : struct
            where TUnionDefinition : notnull, UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive>
            where TOne : notnull
            where TTwo : notnull
            where TThree : notnull
            where TFour : notnull
            where TFive : notnull
        {
            await union.Match(one, two, three, four, five);

            return(union.AsUnion());
        }
예제 #9
0
        public static async Task <TUnionType> DoAsync <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven, TEight>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven, TEight> > union, Func <TOne, Task> one, Func <TTwo, Task> two, Func <TThree, Task> three, Func <TFour, Task> four, Func <TFive, Task> five, Func <TSix, Task> six, Func <TSeven, Task> seven, Func <TEight, Task> eight)
            where TUnionType : struct
            where TUnionDefinition : notnull, UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo, TThree, TFour, TFive, TSix, TSeven, TEight>
            where TOne : notnull
            where TTwo : notnull
            where TThree : notnull
            where TFour : notnull
            where TFive : notnull
            where TSix : notnull
            where TSeven : notnull
            where TEight : notnull
        {
            await union.Match(one, two, three, four, five, six, seven, eight);

            return(union.AsUnion());
        }
예제 #10
0
        public static TUnionType Do <TUnionType, TUnionDefinition, TOne, TTwo>(this IUnionValue <UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo> > union, Action <TOne> one, Action <TTwo> two)
            where TUnionType : struct
            where TUnionDefinition : notnull, UnionDefinitionBase <TUnionType, TUnionDefinition, TOne, TTwo>
            where TOne : notnull
            where TTwo : notnull
        {
            if (one == null)
            {
                throw new ArgumentNullException(nameof(one));
            }

            if (two == null)
            {
                throw new ArgumentNullException(nameof(two));
            }

            union.Match(value => { one.Invoke(value); return(false); }, value => { two.Invoke(value); return(false); });

            return(union.AsUnion());
        }