What's so great about Func<> delegate?

前端 未结 6 625
迷失自我
迷失自我 2020-12-12 13:57

Sorry if this is basic but I was trying to pick up on .Net 3.5.

Question: Is there anything great about Func<> and it\'s 5 overloads? From the looks of it, I can

6条回答
  •  失恋的感觉
    2020-12-12 14:27

    In addition to Marxidad's correct answer:

    • It's worth being aware of Func's related family, the Action delegates. Again, these are types overloaded by the number of type parameters, but declared to return void.
    • If you want to use Func/Action in a .NET 2.0 project but with a simple route to upgrading later on, you can cut and paste the declarations from my version comparison page. If you declare them in the System namespace then you'll be able to upgrade just by removing the declarations later - but then you won't be able to (easily) build the same code in .NET 3.5 without removing the declarations.

提交回复
热议问题