software master at the intersection of technology, science and art



partial types

Partial type definitions allow for the definition of a class, struct, or interface to be split into multiple files. 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.

My most common use has been with ORM, Ling to SQl or Entity Framework, in defining metadata and attributes to the auto generated business objects.

The partial keyword modifier designates a "split", i.e. definition or declaration. The partial keyword indicates that other parts of the class, struct, or interface can be defined in the namespace. All the parts must use the partial keyword. All the parts must be available at compile time to form the final type. All the parts must have the same accessibility, such as public, private, and so on. For further discusion see Partial Classes and Methods