C# language feature:

  • Partials

applies to

  • properties and methods of classes

benefit

  • Partials are useful in
  • 1) allowing mix of hand coding (developers) and auto generated code (e.g. visual studio wrapper, generated code).
  • 2) large projects facilitating multiple developers to work on a class/project at the same time.

how to use

  • Precede the class declaration wih partial keyword modifier.

example:

    // note partial keyword
    partial class Partial_Class_Example
    {
        string name { set; get; }
    }

    // declaration below can be in a different or even the same file
    partial class Partial_Class_Example  // note the class name is the same as above!
    {
        string  phone { set; get; }
    }