How are partial methods used in C# 3.0?

前端 未结 5 1144
终归单人心
终归单人心 2020-12-31 02:57

I have read about partial methods in the latest C# language specification, so I understand the principles, but I\'m wondering how people are actually using them. Is there a

5条回答
  •  臣服心动
    2020-12-31 03:35

    I see them as lightweight events. You can have a reusable code file (usually autogenerated but not necessarily) and for each implementation, just handle the events you care about in your partial class. In fact, this is how it's used in LINQ to SQL (and why the language feature was invented).

提交回复
热议问题