Partial type
From Free net encyclopedia
In computing, a partial type is a data type definition which spans multiple source code files. In object oriented programming this is desirable as the use of code-generating tools is increasing, and it is convenient to separate machine generated code from code written by the programmer.
Partial types are a feature of the C# 2.0 language. The syntax for creating a partial class definition is as follows:
SourceFile1.cs
public partial class ExampleClass { public void SomeFunction() { // ... } }
SourceFile2.cs
public partial class ExampleClass { public void SomeOtherFunction() { // ... } }
In languages without partial types' support, this would cause a compiler error because the same class appears to be defined twice. In supporting languages this is treated as a single class definition.
The use of partial classes has no effect on generated code (unless editor meta-data is emitted).zh:不完全类型