Using the “params” keyword for generic parameters in C#

is it possible in C# to specify that a generic type can have any number of type arguments?

No, C# doesn’t have anything like that I’m afraid.

Fundamentally Func<T> and Func<T1, T2> are entirely unrelated types as far as the CLR is concerned, and there’s nothing like params to specify multiple type arguments.

As for its utility: I can see cases where it could be useful, but I suspect they’re rare enough to mean the feature doesn’t cross the “benefit/cost” threshold. (Note that it would almost certainly require CLR changes too.)

Leave a Comment