C# - Anonymous delegate

前端 未结 7 1807
有刺的猬
有刺的猬 2021-02-07 08:00

Like Anonymous Methods ,the delegates i am declaring down using \"delegate\" keyword are anonymous delegates?

namespace Test
{
    public delegate void MyDelegat         


        
7条回答
  •  执笔经年
    2021-02-07 08:23

    They are delegates to anonymous methods. This is one way to make anonymous methods, which was available since .NET 2.0. With .NET 3.0 you can also use lambda expressions which are simpler to write (but compile to the same code). I suppose that's what you meant with "anonymouse methods". But really, they are one and the same thing.

提交回复
热议问题