Why you need partial methods in c#? Can events be used to achieve the same goal?

后端 未结 4 1722
南笙
南笙 2021-01-04 08:48

I was reading the book \"Apress Pro LINQ: Language Integrated Query in C#\" and I came across partial methods, but I really don\'t understand what is the need for them.

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-04 09:34

    Partial methods are defined at compile time, events at runtime. So they are different things.

    Partial methods were brought to the picture to extend existing classes that you have no control over (part of the framework or auto-generated)

    Hope this helps

提交回复
热议问题