Skip to content

Instantly share code, notes, and snippets.

@tonygiang
Created May 12, 2022 08:56
Show Gist options
  • Save tonygiang/7b86602c72fd999f2c3a23f18f2c9ceb to your computer and use it in GitHub Desktop.
Save tonygiang/7b86602c72fd999f2c3a23f18f2c9ceb to your computer and use it in GitHub Desktop.
// Author: Tony Giang
using System;
using System.Collections.Generic;
public partial class SortedAction<TKey> : SortedList<TKey, Action> { }
public partial class SortedAction<TKey, T> : SortedList<TKey, Action<T>> { }
public partial class SortedAction<TKey, T1, T2>
: SortedList<TKey, Action<T1, T2>>
{ }
public partial class SortedAction<TKey, T1, T2, T3>
: SortedList<TKey, Action<T1, T2, T3>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4>
: SortedList<TKey, Action<T1, T2, T3, T4>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5>
: SortedList<TKey, Action<T1, T2, T3, T4, T5>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>>
{ }
public partial class SortedAction<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>
: SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>>
{ }
public static partial class ExtensionMethods
{
public static void Invoke<TKey>(this SortedList<TKey, Action> source)
{ foreach (var p in source) p.Value(); }
public static void Invoke<TKey, T>(
this SortedList<TKey, Action<T>> source,
T arg)
{ foreach (var p in source) p.Value(arg); }
public static void Invoke<TKey, T1, T2>(
this SortedList<TKey, Action<T1, T2>> source,
T1 arg1,
T2 arg2)
{
foreach (var p in source) p.Value(arg1,
arg2);
}
public static void Invoke<TKey, T1, T2, T3>(
this SortedList<TKey, Action<T1, T2, T3>> source,
T1 arg1,
T2 arg2,
T3 arg3)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3);
}
public static void Invoke<TKey, T1, T2, T3, T4>(
this SortedList<TKey, Action<T1, T2, T3, T4>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9,
T10 arg10)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9,
T10 arg10,
T11 arg11)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10,
arg11);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9,
T10 arg10,
T11 arg11,
T12 arg12)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10,
arg11,
arg12);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9,
T10 arg10,
T11 arg11,
T12 arg12,
T13 arg13)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10,
arg11,
arg12,
arg13);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9,
T10 arg10,
T11 arg11,
T12 arg12,
T13 arg13,
T14 arg14)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10,
arg11,
arg12,
arg13,
arg14);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9,
T10 arg10,
T11 arg11,
T12 arg12,
T13 arg13,
T14 arg14,
T15 arg15)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10,
arg11,
arg12,
arg13,
arg14,
arg15);
}
public static void Invoke<TKey, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
this SortedList<TKey, Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> source,
T1 arg1,
T2 arg2,
T3 arg3,
T4 arg4,
T5 arg5,
T6 arg6,
T7 arg7,
T8 arg8,
T9 arg9,
T10 arg10,
T11 arg11,
T12 arg12,
T13 arg13,
T14 arg14,
T15 arg15,
T16 arg16)
{
foreach (var p in source) p.Value(arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7,
arg8,
arg9,
arg10,
arg11,
arg12,
arg13,
arg14,
arg15,
arg16);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment