Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual C#
C# Reference
C# Keywords
 partial (Type)
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
C# Language Reference
partial (Type) (C# Reference)

Partial type definitions allow for the definition of a class, struct, or interface to be split into multiple files.

In File1.cs:

C#
namespace PC
{
    partial class A 
    {
        int num = 0;
        void MethodA() { }
        partial void MethodC();
    }
}

In File2.cs the declaration:

C#
namespace PC
{
    partial class A 
    {
        void MethodB(){}
        partial void MethodC() { }
    }
}

Splitting a class, struct or interface type over several files can be useful when you are working with large projects, or with automatically generated code such as that provided by the Windows Forms Designer. A partial type may contain a partial method. For more information, see Partial Classes and Methods (C# Programming Guide).

For more information, see the following section in the C# Language Specification:

  • 10.2 Partial types

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker