What is the use of a partial class?

前端 未结 10 966
梦谈多话
梦谈多话 2021-01-13 00:15

How can a partial class be useful in coding? Can anyone explain in detail with examples?

10条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-13 01:13

    1. When working on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously.
    2. When working with automatically generated source, code can be added to the class without having to recreate the source file. Visual Studio uses this approach when creating Windows Forms, Web Service wrapper code, and so on. You can create code that uses these classes without having to edit the file created by Visual Studio.

    Source msdn.

    Have a look at this link.

提交回复
热议问题