diff --git a/Generator/Program.cs b/Generator/Program.cs index 447293a..5d194d5 100644 --- a/Generator/Program.cs +++ b/Generator/Program.cs @@ -38,6 +38,10 @@ string GetContent(bool isStruct, int i) { var sb = new StringBuilder(); sb.Append(@$"using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -100,6 +104,18 @@ public void Switch({RangeJoined(", ", e => $"Action f{e}")}) throw new InvalidOperationException(); }} +#if !NET35 + public Task Switch({RangeJoined(", ", e => $"Func f{e}")}) + {{ + {RangeJoined(@" + ", j => @$"if (_index == {j} && f{j} != null) + {{ + return f{j}(_value{j}); + }}")} + throw new InvalidOperationException(); + }} +#endif + public TResult Match({RangeJoined(", ", e => $"Func f{e}")}) {{ {RangeJoined(@" diff --git a/OneOf.Extended/OneOfBaseT10.generated.cs b/OneOf.Extended/OneOfBaseT10.generated.cs index 3c61780..5933428 100644 --- a/OneOf.Extended/OneOfBaseT10.generated.cs +++ b/OneOf.Extended/OneOfBaseT10.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -176,6 +180,57 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT11.generated.cs b/OneOf.Extended/OneOfBaseT11.generated.cs index cc72a59..88e0b1e 100644 --- a/OneOf.Extended/OneOfBaseT11.generated.cs +++ b/OneOf.Extended/OneOfBaseT11.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -189,6 +193,61 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT12.generated.cs b/OneOf.Extended/OneOfBaseT12.generated.cs index 7b9c66d..ce889ed 100644 --- a/OneOf.Extended/OneOfBaseT12.generated.cs +++ b/OneOf.Extended/OneOfBaseT12.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -202,6 +206,65 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT13.generated.cs b/OneOf.Extended/OneOfBaseT13.generated.cs index ccf0cd7..c9077e8 100644 --- a/OneOf.Extended/OneOfBaseT13.generated.cs +++ b/OneOf.Extended/OneOfBaseT13.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -215,6 +219,69 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT14.generated.cs b/OneOf.Extended/OneOfBaseT14.generated.cs index cade467..57c9a10 100644 --- a/OneOf.Extended/OneOfBaseT14.generated.cs +++ b/OneOf.Extended/OneOfBaseT14.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -228,6 +232,73 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT15.generated.cs b/OneOf.Extended/OneOfBaseT15.generated.cs index 05132d2..c4a6511 100644 --- a/OneOf.Extended/OneOfBaseT15.generated.cs +++ b/OneOf.Extended/OneOfBaseT15.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -241,6 +245,77 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT16.generated.cs b/OneOf.Extended/OneOfBaseT16.generated.cs index d59e70a..2227d25 100644 --- a/OneOf.Extended/OneOfBaseT16.generated.cs +++ b/OneOf.Extended/OneOfBaseT16.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -254,6 +258,81 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT17.generated.cs b/OneOf.Extended/OneOfBaseT17.generated.cs index b50d501..7c858e1 100644 --- a/OneOf.Extended/OneOfBaseT17.generated.cs +++ b/OneOf.Extended/OneOfBaseT17.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -267,6 +271,85 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT18.generated.cs b/OneOf.Extended/OneOfBaseT18.generated.cs index 9749b93..7130435 100644 --- a/OneOf.Extended/OneOfBaseT18.generated.cs +++ b/OneOf.Extended/OneOfBaseT18.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -280,6 +284,89 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT19.generated.cs b/OneOf.Extended/OneOfBaseT19.generated.cs index 76a2c60..fd96e66 100644 --- a/OneOf.Extended/OneOfBaseT19.generated.cs +++ b/OneOf.Extended/OneOfBaseT19.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -293,6 +297,93 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT20.generated.cs b/OneOf.Extended/OneOfBaseT20.generated.cs index 7f69d8f..d85b4d8 100644 --- a/OneOf.Extended/OneOfBaseT20.generated.cs +++ b/OneOf.Extended/OneOfBaseT20.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -306,6 +310,97 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT21.generated.cs b/OneOf.Extended/OneOfBaseT21.generated.cs index a6b02ee..219823b 100644 --- a/OneOf.Extended/OneOfBaseT21.generated.cs +++ b/OneOf.Extended/OneOfBaseT21.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -319,6 +323,101 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT22.generated.cs b/OneOf.Extended/OneOfBaseT22.generated.cs index daca4ef..5f2d7bb 100644 --- a/OneOf.Extended/OneOfBaseT22.generated.cs +++ b/OneOf.Extended/OneOfBaseT22.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -332,6 +336,105 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT23.generated.cs b/OneOf.Extended/OneOfBaseT23.generated.cs index 78a26b5..d195604 100644 --- a/OneOf.Extended/OneOfBaseT23.generated.cs +++ b/OneOf.Extended/OneOfBaseT23.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -345,6 +349,109 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT24.generated.cs b/OneOf.Extended/OneOfBaseT24.generated.cs index c291a10..27ad8dc 100644 --- a/OneOf.Extended/OneOfBaseT24.generated.cs +++ b/OneOf.Extended/OneOfBaseT24.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -358,6 +362,113 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT25.generated.cs b/OneOf.Extended/OneOfBaseT25.generated.cs index dc06dc9..00ab3ab 100644 --- a/OneOf.Extended/OneOfBaseT25.generated.cs +++ b/OneOf.Extended/OneOfBaseT25.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -371,6 +375,117 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT26.generated.cs b/OneOf.Extended/OneOfBaseT26.generated.cs index edd010b..fb6f1e4 100644 --- a/OneOf.Extended/OneOfBaseT26.generated.cs +++ b/OneOf.Extended/OneOfBaseT26.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -384,6 +388,121 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT27.generated.cs b/OneOf.Extended/OneOfBaseT27.generated.cs index ae54cde..3cd5e3e 100644 --- a/OneOf.Extended/OneOfBaseT27.generated.cs +++ b/OneOf.Extended/OneOfBaseT27.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -397,6 +401,125 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT28.generated.cs b/OneOf.Extended/OneOfBaseT28.generated.cs index 611c63e..70aa1c3 100644 --- a/OneOf.Extended/OneOfBaseT28.generated.cs +++ b/OneOf.Extended/OneOfBaseT28.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -410,6 +414,129 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT29.generated.cs b/OneOf.Extended/OneOfBaseT29.generated.cs index 8348e0d..c6860c3 100644 --- a/OneOf.Extended/OneOfBaseT29.generated.cs +++ b/OneOf.Extended/OneOfBaseT29.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -423,6 +427,133 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + if (_index == 29 && f29 != null) + { + return f29(_value29); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT30.generated.cs b/OneOf.Extended/OneOfBaseT30.generated.cs index 25229bd..26b51eb 100644 --- a/OneOf.Extended/OneOfBaseT30.generated.cs +++ b/OneOf.Extended/OneOfBaseT30.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -436,6 +440,137 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + if (_index == 29 && f29 != null) + { + return f29(_value29); + } + if (_index == 30 && f30 != null) + { + return f30(_value30); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT31.generated.cs b/OneOf.Extended/OneOfBaseT31.generated.cs index 9a1fa4d..c744fc1 100644 --- a/OneOf.Extended/OneOfBaseT31.generated.cs +++ b/OneOf.Extended/OneOfBaseT31.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -449,6 +453,141 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30, Func f31) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + if (_index == 29 && f29 != null) + { + return f29(_value29); + } + if (_index == 30 && f30 != null) + { + return f30(_value30); + } + if (_index == 31 && f31 != null) + { + return f31(_value31); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30, Func f31) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfBaseT9.generated.cs b/OneOf.Extended/OneOfBaseT9.generated.cs index 9510257..4ff9a38 100644 --- a/OneOf.Extended/OneOfBaseT9.generated.cs +++ b/OneOf.Extended/OneOfBaseT9.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -163,6 +167,53 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT10.generated.cs b/OneOf.Extended/OneOfT10.generated.cs index 4388f8b..be6365f 100644 --- a/OneOf.Extended/OneOfT10.generated.cs +++ b/OneOf.Extended/OneOfT10.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -182,6 +186,57 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT11.generated.cs b/OneOf.Extended/OneOfT11.generated.cs index 85e4e29..34b28fe 100644 --- a/OneOf.Extended/OneOfT11.generated.cs +++ b/OneOf.Extended/OneOfT11.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -196,6 +200,61 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT12.generated.cs b/OneOf.Extended/OneOfT12.generated.cs index 18d58ab..37338bb 100644 --- a/OneOf.Extended/OneOfT12.generated.cs +++ b/OneOf.Extended/OneOfT12.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -210,6 +214,65 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT13.generated.cs b/OneOf.Extended/OneOfT13.generated.cs index eb7bd16..c57f805 100644 --- a/OneOf.Extended/OneOfT13.generated.cs +++ b/OneOf.Extended/OneOfT13.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -224,6 +228,69 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT14.generated.cs b/OneOf.Extended/OneOfT14.generated.cs index 0acf85e..03adf40 100644 --- a/OneOf.Extended/OneOfT14.generated.cs +++ b/OneOf.Extended/OneOfT14.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -238,6 +242,73 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT15.generated.cs b/OneOf.Extended/OneOfT15.generated.cs index 336d399..fcb89a7 100644 --- a/OneOf.Extended/OneOfT15.generated.cs +++ b/OneOf.Extended/OneOfT15.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -252,6 +256,77 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT16.generated.cs b/OneOf.Extended/OneOfT16.generated.cs index 2382dfd..7ee404c 100644 --- a/OneOf.Extended/OneOfT16.generated.cs +++ b/OneOf.Extended/OneOfT16.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -266,6 +270,81 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT17.generated.cs b/OneOf.Extended/OneOfT17.generated.cs index ad571ba..c30bf71 100644 --- a/OneOf.Extended/OneOfT17.generated.cs +++ b/OneOf.Extended/OneOfT17.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -280,6 +284,85 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT18.generated.cs b/OneOf.Extended/OneOfT18.generated.cs index e0e91e3..cdc3046 100644 --- a/OneOf.Extended/OneOfT18.generated.cs +++ b/OneOf.Extended/OneOfT18.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -294,6 +298,89 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT19.generated.cs b/OneOf.Extended/OneOfT19.generated.cs index 31b8e88..6a3ff09 100644 --- a/OneOf.Extended/OneOfT19.generated.cs +++ b/OneOf.Extended/OneOfT19.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -308,6 +312,93 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT20.generated.cs b/OneOf.Extended/OneOfT20.generated.cs index e938013..1df88e1 100644 --- a/OneOf.Extended/OneOfT20.generated.cs +++ b/OneOf.Extended/OneOfT20.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -322,6 +326,97 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT21.generated.cs b/OneOf.Extended/OneOfT21.generated.cs index d20e534..5eec2f5 100644 --- a/OneOf.Extended/OneOfT21.generated.cs +++ b/OneOf.Extended/OneOfT21.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -336,6 +340,101 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT22.generated.cs b/OneOf.Extended/OneOfT22.generated.cs index cb5ab64..5f9d45b 100644 --- a/OneOf.Extended/OneOfT22.generated.cs +++ b/OneOf.Extended/OneOfT22.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -350,6 +354,105 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT23.generated.cs b/OneOf.Extended/OneOfT23.generated.cs index 5ceaad6..b08fe7f 100644 --- a/OneOf.Extended/OneOfT23.generated.cs +++ b/OneOf.Extended/OneOfT23.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -364,6 +368,109 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT24.generated.cs b/OneOf.Extended/OneOfT24.generated.cs index 6d1782d..bb6a68f 100644 --- a/OneOf.Extended/OneOfT24.generated.cs +++ b/OneOf.Extended/OneOfT24.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -378,6 +382,113 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT25.generated.cs b/OneOf.Extended/OneOfT25.generated.cs index 6f04936..e1d1233 100644 --- a/OneOf.Extended/OneOfT25.generated.cs +++ b/OneOf.Extended/OneOfT25.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -392,6 +396,117 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT26.generated.cs b/OneOf.Extended/OneOfT26.generated.cs index 0e31026..2e07284 100644 --- a/OneOf.Extended/OneOfT26.generated.cs +++ b/OneOf.Extended/OneOfT26.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -406,6 +410,121 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT27.generated.cs b/OneOf.Extended/OneOfT27.generated.cs index 315c1c2..357931f 100644 --- a/OneOf.Extended/OneOfT27.generated.cs +++ b/OneOf.Extended/OneOfT27.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -420,6 +424,125 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT28.generated.cs b/OneOf.Extended/OneOfT28.generated.cs index 78a7844..5ea3ca5 100644 --- a/OneOf.Extended/OneOfT28.generated.cs +++ b/OneOf.Extended/OneOfT28.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -434,6 +438,129 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT29.generated.cs b/OneOf.Extended/OneOfT29.generated.cs index 3922541..678a675 100644 --- a/OneOf.Extended/OneOfT29.generated.cs +++ b/OneOf.Extended/OneOfT29.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -448,6 +452,133 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + if (_index == 29 && f29 != null) + { + return f29(_value29); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT30.generated.cs b/OneOf.Extended/OneOfT30.generated.cs index e1211f5..5d519a3 100644 --- a/OneOf.Extended/OneOfT30.generated.cs +++ b/OneOf.Extended/OneOfT30.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -462,6 +466,137 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + if (_index == 29 && f29 != null) + { + return f29(_value29); + } + if (_index == 30 && f30 != null) + { + return f30(_value30); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT31.generated.cs b/OneOf.Extended/OneOfT31.generated.cs index 4df8610..885ffdf 100644 --- a/OneOf.Extended/OneOfT31.generated.cs +++ b/OneOf.Extended/OneOfT31.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -476,6 +480,141 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30, Func f31) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + if (_index == 10 && f10 != null) + { + return f10(_value10); + } + if (_index == 11 && f11 != null) + { + return f11(_value11); + } + if (_index == 12 && f12 != null) + { + return f12(_value12); + } + if (_index == 13 && f13 != null) + { + return f13(_value13); + } + if (_index == 14 && f14 != null) + { + return f14(_value14); + } + if (_index == 15 && f15 != null) + { + return f15(_value15); + } + if (_index == 16 && f16 != null) + { + return f16(_value16); + } + if (_index == 17 && f17 != null) + { + return f17(_value17); + } + if (_index == 18 && f18 != null) + { + return f18(_value18); + } + if (_index == 19 && f19 != null) + { + return f19(_value19); + } + if (_index == 20 && f20 != null) + { + return f20(_value20); + } + if (_index == 21 && f21 != null) + { + return f21(_value21); + } + if (_index == 22 && f22 != null) + { + return f22(_value22); + } + if (_index == 23 && f23 != null) + { + return f23(_value23); + } + if (_index == 24 && f24 != null) + { + return f24(_value24); + } + if (_index == 25 && f25 != null) + { + return f25(_value25); + } + if (_index == 26 && f26 != null) + { + return f26(_value26); + } + if (_index == 27 && f27 != null) + { + return f27(_value27); + } + if (_index == 28 && f28 != null) + { + return f28(_value28); + } + if (_index == 29 && f29 != null) + { + return f29(_value29); + } + if (_index == 30 && f30 != null) + { + return f30(_value30); + } + if (_index == 31 && f31 != null) + { + return f31(_value31); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9, Func f10, Func f11, Func f12, Func f13, Func f14, Func f15, Func f16, Func f17, Func f18, Func f19, Func f20, Func f21, Func f22, Func f23, Func f24, Func f25, Func f26, Func f27, Func f28, Func f29, Func f30, Func f31) { if (_index == 0 && f0 != null) diff --git a/OneOf.Extended/OneOfT9.generated.cs b/OneOf.Extended/OneOfT9.generated.cs index 01f5ee3..de57bda 100644 --- a/OneOf.Extended/OneOfT9.generated.cs +++ b/OneOf.Extended/OneOfT9.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -168,6 +172,53 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + if (_index == 9 && f9 != null) + { + return f9(_value9); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8, Func f9) { if (_index == 0 && f0 != null) diff --git a/OneOf.Tests/SwitchTests.cs b/OneOf.Tests/SwitchTests.cs new file mode 100644 index 0000000..e979cde --- /dev/null +++ b/OneOf.Tests/SwitchTests.cs @@ -0,0 +1,66 @@ +using System; +using System.Globalization; +using System.Threading.Tasks; +using NUnit.Framework; +using OneOf; + +namespace OneOf.Tests +{ + public class SwitchTests + { + private class SwitchAsyncException : Exception + { + + } + + [Test] + public async Task SwitchAsync() + { + OneOf oneof = 10f; + string result = string.Empty; + + await oneof.Switch(async f0 => + { + result = await DoWorkAsync(f0); + }, async f1 => + { + result = await DoWorkAsync(f1); + }); + + Assert.AreEqual("10.00", result); + + Assert.ThrowsAsync(async () => + { + await oneof.Switch(async f0 => + { + result = await DoWorkAsync(f0); + }, async f1 => + { + result = await DoWorkWithErrorAsync(f1); + }); + + }); + } + + private string ResolveString(OneOf input) + => input + .MapT0(d => d.ToString(CultureInfo.InvariantCulture)) + .MapT1(i => i.ToString(CultureInfo.InvariantCulture)) + .Match(t1 => t1, t2 => t2, t3 => t3); + + private Task DoWorkAsync(int value) + { + return Task.FromResult(value.ToString()); + } + + private Task DoWorkAsync(float value) + { + return Task.FromResult(value.ToString("N")); + } + + private Task DoWorkWithErrorAsync(float value) + { + throw new SwitchAsyncException(); + } + } +} diff --git a/OneOf/OneOf.csproj b/OneOf/OneOf.csproj index e595427..15ae1c1 100644 --- a/OneOf/OneOf.csproj +++ b/OneOf/OneOf.csproj @@ -25,4 +25,22 @@ + + + + 4.3.0 + + + + + + 4.3.0 + + + + + + 4.3.0 + + \ No newline at end of file diff --git a/OneOf/OneOfBaseT0.generated.cs b/OneOf/OneOfBaseT0.generated.cs index 52a7fba..c5792e2 100644 --- a/OneOf/OneOfBaseT0.generated.cs +++ b/OneOf/OneOfBaseT0.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -46,6 +50,17 @@ public void Switch(Action f0) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT1.generated.cs b/OneOf/OneOfBaseT1.generated.cs index b5816b4..6d374ca 100644 --- a/OneOf/OneOfBaseT1.generated.cs +++ b/OneOf/OneOfBaseT1.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -59,6 +63,21 @@ public void Switch(Action f0, Action f1) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT2.generated.cs b/OneOf/OneOfBaseT2.generated.cs index d8ed1a8..7b121d9 100644 --- a/OneOf/OneOfBaseT2.generated.cs +++ b/OneOf/OneOfBaseT2.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -72,6 +76,25 @@ public void Switch(Action f0, Action f1, Action f2) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT3.generated.cs b/OneOf/OneOfBaseT3.generated.cs index c47bd8e..964e895 100644 --- a/OneOf/OneOfBaseT3.generated.cs +++ b/OneOf/OneOfBaseT3.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -85,6 +89,29 @@ public void Switch(Action f0, Action f1, Action f2, Action f3) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT4.generated.cs b/OneOf/OneOfBaseT4.generated.cs index 454c6cf..56c70bf 100644 --- a/OneOf/OneOfBaseT4.generated.cs +++ b/OneOf/OneOfBaseT4.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -98,6 +102,33 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT5.generated.cs b/OneOf/OneOfBaseT5.generated.cs index feb72c3..264ab08 100644 --- a/OneOf/OneOfBaseT5.generated.cs +++ b/OneOf/OneOfBaseT5.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -111,6 +115,37 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT6.generated.cs b/OneOf/OneOfBaseT6.generated.cs index 607b865..06b9557 100644 --- a/OneOf/OneOfBaseT6.generated.cs +++ b/OneOf/OneOfBaseT6.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -124,6 +128,41 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT7.generated.cs b/OneOf/OneOfBaseT7.generated.cs index c30d6bf..a2fdc0d 100644 --- a/OneOf/OneOfBaseT7.generated.cs +++ b/OneOf/OneOfBaseT7.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -137,6 +141,45 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfBaseT8.generated.cs b/OneOf/OneOfBaseT8.generated.cs index 5ee8beb..73ee231 100644 --- a/OneOf/OneOfBaseT8.generated.cs +++ b/OneOf/OneOfBaseT8.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -150,6 +154,49 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT0.generated.cs b/OneOf/OneOfT0.generated.cs index ff5d4e5..bd89d78 100644 --- a/OneOf/OneOfT0.generated.cs +++ b/OneOf/OneOfT0.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -42,6 +46,17 @@ public void Switch(Action f0) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT1.generated.cs b/OneOf/OneOfT1.generated.cs index 1073322..91c6cfa 100644 --- a/OneOf/OneOfT1.generated.cs +++ b/OneOf/OneOfT1.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -56,6 +60,21 @@ public void Switch(Action f0, Action f1) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT2.generated.cs b/OneOf/OneOfT2.generated.cs index 9d9186f..3ca20e9 100644 --- a/OneOf/OneOfT2.generated.cs +++ b/OneOf/OneOfT2.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -70,6 +74,25 @@ public void Switch(Action f0, Action f1, Action f2) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT3.generated.cs b/OneOf/OneOfT3.generated.cs index 0f1c46f..de1eb4f 100644 --- a/OneOf/OneOfT3.generated.cs +++ b/OneOf/OneOfT3.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -84,6 +88,29 @@ public void Switch(Action f0, Action f1, Action f2, Action f3) throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT4.generated.cs b/OneOf/OneOfT4.generated.cs index 3b5919b..029c335 100644 --- a/OneOf/OneOfT4.generated.cs +++ b/OneOf/OneOfT4.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -98,6 +102,33 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT5.generated.cs b/OneOf/OneOfT5.generated.cs index 4d8cce7..51ccf43 100644 --- a/OneOf/OneOfT5.generated.cs +++ b/OneOf/OneOfT5.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -112,6 +116,37 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT6.generated.cs b/OneOf/OneOfT6.generated.cs index 7933916..4d5b0cf 100644 --- a/OneOf/OneOfT6.generated.cs +++ b/OneOf/OneOfT6.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -126,6 +130,41 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT7.generated.cs b/OneOf/OneOfT7.generated.cs index 878ca56..c5dad4c 100644 --- a/OneOf/OneOfT7.generated.cs +++ b/OneOf/OneOfT7.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -140,6 +144,45 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7) { if (_index == 0 && f0 != null) diff --git a/OneOf/OneOfT8.generated.cs b/OneOf/OneOfT8.generated.cs index f8bdcfa..9cac5ac 100644 --- a/OneOf/OneOfT8.generated.cs +++ b/OneOf/OneOfT8.generated.cs @@ -1,4 +1,8 @@ using System; + +#if !NET35 +using System.Threading.Tasks; +#endif using static OneOf.Functions; namespace OneOf @@ -154,6 +158,49 @@ public void Switch(Action f0, Action f1, Action f2, Action f3, A throw new InvalidOperationException(); } +#if !NET35 + public Task Switch(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8) + { + if (_index == 0 && f0 != null) + { + return f0(_value0); + } + if (_index == 1 && f1 != null) + { + return f1(_value1); + } + if (_index == 2 && f2 != null) + { + return f2(_value2); + } + if (_index == 3 && f3 != null) + { + return f3(_value3); + } + if (_index == 4 && f4 != null) + { + return f4(_value4); + } + if (_index == 5 && f5 != null) + { + return f5(_value5); + } + if (_index == 6 && f6 != null) + { + return f6(_value6); + } + if (_index == 7 && f7 != null) + { + return f7(_value7); + } + if (_index == 8 && f8 != null) + { + return f8(_value8); + } + throw new InvalidOperationException(); + } +#endif + public TResult Match(Func f0, Func f1, Func f2, Func f3, Func f4, Func f5, Func f6, Func f7, Func f8) { if (_index == 0 && f0 != null)