Skip to content

Instantly share code, notes, and snippets.

@vors
Created December 1, 2014 23:58
Show Gist options
  • Save vors/4d96fb04fbe124c464eb to your computer and use it in GitHub Desktop.
Save vors/4d96fb04fbe124c464eb to your computer and use it in GitHub Desktop.
Generate signatures for C# delegates
function Get-Action([int]$i)
{
'public delegate void Action<' + [string]::Join(", ", (1..$i | %{"in T$_"})) + '>(' + [string]::Join(", ", (1..$i | %{"T$_ arg$_"})) + ');'
}
function Get-Func([int]$i)
{
'public delegate TResult Func<' + [string]::Join(", ", (1..$i | %{"in T$_"})) + ', out TResult>(' + [string]::Join(", ", (1..$i | %{"T$_ arg$_"})) + ');'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment