Skip to content

Instantly share code, notes, and snippets.

@atsushieno
Created January 17, 2012 11:56
Show Gist options
  • Save atsushieno/1626397 to your computer and use it in GitHub Desktop.
Save atsushieno/1626397 to your computer and use it in GitHub Desktop.
static Type GetActionFuncType (int count, bool func)
{
if (func) {
switch (count) {
case 1: return typeof (Func<>);
case 2: return typeof (Func<,>);
case 3: return typeof (Func<,,>);
case 4: return typeof (Func<,,,>);
case 5: return typeof (Func<,,,,>);
case 6: return typeof (Func<,,,,,>);
case 7: return typeof (Func<,,,,,,>);
case 8: return typeof (Func<,,,,,,,>);
case 9: return typeof (Func<,,,,,,,,>);
case 10: return typeof (Func<,,,,,,,,,>);
case 11: return typeof (Func<,,,,,,,,,,>);
case 12: return typeof (Func<,,,,,,,,,,,>);
case 13: return typeof (Func<,,,,,,,,,,,,>);
default: throw new NotSupportedException ();
}
} else {
switch (count) {
case 1: return typeof (Action<>);
case 2: return typeof (Action<,>);
case 3: return typeof (Action<,,>);
case 4: return typeof (Action<,,,>);
case 5: return typeof (Action<,,,,>);
case 6: return typeof (Action<,,,,,>);
case 7: return typeof (Action<,,,,,,>);
case 8: return typeof (Action<,,,,,,,>);
case 9: return typeof (Action<,,,,,,,,>);
case 10: return typeof (Action<,,,,,,,,,>);
case 11: return typeof (Action<,,,,,,,,,,>);
case 12: return typeof (Action<,,,,,,,,,,,>);
case 13: return typeof (Action<,,,,,,,,,,,,>);
default: throw new NotSupportedException ();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment