Why don't Funcs accept more than 16 arguments?

后端 未结 6 973
情话喂你
情话喂你 2021-02-05 04:54

Since Javascript is the language that I am the most proficient at, I am familiar with using functions as first-class objects. I had thought that C# lacked this feature, but then

6条回答
  •  情话喂你
    2021-02-05 05:20

    System.Func delegates are probably there thanks to the BCL team.. who realised including a finite number of predefined generic delegates would be handy (and even required for a lot of situations).

    To do what you say.. i.e. unlimited number of generic parameters for a Func delegate would require a language change.. the responsiblity would lie with both c# and vb.net teams (and the others probably) to change the language to allow this.

    Maybe, at some point, if the benefit of this feature outweighs the cost of predefining a handful of Func delegates and this is more important than other language changes (and that it isn't a breaking change) the relevent teams my implement unlimited generic parameters.. might not be for a while though!

提交回复
热议问题