kaveer
9/7/2016 - 10:37 AM

Class

Class

//you can split the source code for a class into separate files so that you can organize the definition of a large class into smaller, easier to manage pieces
//When you split a class across multiple files, you define the parts of the class by using the partial keyword in each file

//For example, if the Circle class is split between two files called circ1.cs (containing the constructors) and circ2.cs (containing the methods and fields), the contents of circ1.cs look like this:
//
partial class Circle 
{ 
  public Circle() // default constructor 
    { 
      this.radius = 0;
    } 
  public Circle(int initialRadius) // overloaded constructor 
    { 
      this.radius = initialRadius; 
    } 
}

//The contents of circ2.cs look like this:
partial class Circle 
{ 
  private int radius; 
  public double Area() 
    { 
      return Math.PI * this.radius * this.radius; 
    } 
}