Team LiB
Previous Section Next Section

Partial Types

Partial types allow you to break up types consisting of a large amount of source code into several different source files for easier development and maintenance. The partial keyword allows you to define a C# class in multiple files, similar to the way C++ did. It's about time!

The following examples demonstrate the use of partial types.

Code Example: Partial Types, Test1.cs
Start example
public partial class Test
{
       public void MyFirstMethod()
       {
              //Do stuff
       }
}
End example
Code Example: Partial Types, Test2.cs
Start example
public partial class Test
{
       public void MySecondMethod()
       {
            //Do stuff
       }
}
End example

Team LiB
Previous Section Next Section