What is the use of a partial class?

前端 未结 10 967
梦谈多话
梦谈多话 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:05

    The most prevalent example is in code-generation. The WinForms designer as of Visual Studio 2005 does this. It allows code-generated code to go into one file, while your hand-crafted code stays in another file. They are glued together at the end by the compiler.

提交回复
热议问题