-
We have 2 delegates, Action and Func that have a ton of overloads to support multiple parameters, but I'm no sure why don't we have an easier way to make delegates like this, for example, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It does sound like you're suggesting something like variadic generic parameters, such as dotnet/roslyn#5058. |
Beta Was this translation helpful? Give feedback.
Action
andFunc
aren't two delegates, there are 34 separate delegates, one for each arity of parameters. Every delegate type can only have one signature. With generics and generic type parameters it is possible to extend those signatures to support multiple simple use cases, but you can't use generics to change the nature of the parameter, such as making itref
orparams
. That requires a different delegate type.It does sound like you're suggesting something like variadic generic parameters, such as dotnet/roslyn#5058.