This is a shorter to do it first :) 23 Incomplete type 23.1 Incomplete type declaration new type modifier Partial is used to define a type in multiple sections. To ensure compatibility with existing programs, this modifier and other modifiers (such as GET and SET) are different, it is not a keyword, and it must be adjacent to the keyword class, struct, or interface. l class-declaration (class declaration) attributes opt class-modifiers opt partialopt class identifier type-parameter-list opt class-base opt type-parameter-constraints-clausesopt class-body; opt (optionally partial characteristic class modifier may optionally Select Class identifier
Type Parameter List Optional: Base class Optional Type Parameters Constraints Optional Categories; Optional)
l struct-declaration :( structure declarations) attributesopt struct-modifiersopt partialopt struct identifier type-parameter-listopt struct-interfacesopt type-parameter-constraints-clausesopt struct-body; opt (optionally partial characteristic modifiers optional alternative structure struct identification Variable Type Parameter List Optional Structure Interface Optional Type Parameter Constraints Optional Structures; Optional)
l interface-declaration :( interface declarations) attributesopt interface-modifiersopt partialopt interface identifier type-parameter-listopt interface-baseopt type-parameter-constraints-clausesopt interface-body; opt (optionally partial characteristic optional interface modifier optional interface identifier Variable Type Parameter List Optional Base Interface Optional Type Parametric Constraints Optional Interface; Optional) Each portion of the incomplete type declaration must include a Partial modifier, and other parts must be declared in the same namespace. The Partial modifier indicates that the additional portion of this type can exist in other places, but the existence of this additional part is not required; in a single type declaration contains Partial modifiers to be reasonable.
All parts of the incomplete type must be compiled together so they can be fused at compile. In particular, incomplete types do not allow for expansion of types that have been compiled.
Nested type (NESTED TYPE) can be declared in multiple places by using a Partial modifier. Typical situations are included (that is, the type containing nested types) also uses Partial declarations, while each of the nested types is also declared in different parts of the type.
Partial modifiers cannot be used in commission or enumeration statements. 23.1 The characteristics of the incomplete type of characteristics are determined by combining the characteristics of the individual parts in a Unspecified order. If a feature is placed in multiple parts of the incomplete type, it is equivalent to specifying this feature multiple times on this type. For example, these two parts [Attr1, Attr2 ("Hello")] Partial Class A {} [Attr3, Attr2 ("Goodbye")] Partial Class A {} is equivalent to declaration. [Attr1, Attr2 ("Hello"), ATTR3, ATTR2 ("Goodbye") The characteristics on the Class A {} type parameter also combine in the same style. 23.1.2 Modifier
When the incomplete type declaration contains the access instructions (PUBLIC, Protected, INTERNAL, INTER, and Private), it must be consistent with the access instructions of other parts. If the various parts of the incomplete type do not include an access instruction, this type will be given appropriate default accessibility (§ 3.5.1). If one or more incomplete declarations of the nested type include a New modifier, and if the nested type hides an inheritance member, there will be no warnings. (3.7.12)
If one or more incomplete declarations of the class include Abstract modifiers, then this class is abstract (§ 10.1.1.1), which is not abstract.
Note that a class cannot be both abstract and seal.
When UNSAFE modifiers are used for an incomplete type declaration, only a particular portion is considered unsafe up and down [UNSAFE CONTEX (18.1))].
23.1.3 Type parameters and constraints
If the generic type is declared in multiple parts, the type parameters must be explained. Each section must have the same number of type parameters, and for each type of parameters must have the same name and order.
When the incomplete generic declaration contains type parameter constraints (WHERE statement), this constraint must be consistent with other parts of the constraint. In particular, each part of the constraint must have the constraints of the same set type parameters, and the collection of each type of parameters, classes, interfaces, and constructive function constraints must be the same. If any part of the incomplete generic is not specified, the type parameters are considered to be unconstrained. Example Partial Class Dictionary
When the incomplete category contains the base class description, it must be consistent with all other parts that contain the base class. If any part of the incomplete category does not include a base class declaration, the base class will be System.Object (10.1.2.1). 23.1.5 The base interface set of the type of the base connection declared in multiple parts is the combination of the base reference specified in each portion. A particular basegade can only be named once in each portion, but you can name the same base interface in multiple parts. However, there is only a unique implementation for any base scorepoint. In an example Partial Class C: IA, IB {...} Partial Class C: IC {...} Partial Class C: IA, IB {...} The base ports of class C are IA, IB, and ICs. Typically, the implementation of the interface is provided in the part of the interface declaration; however, this is not required. A portion can be implemented for the interface in another part. Partial class x {int icomparable.compareto (Object O) {...}} Partial class x: iComparable {...} 23.1.6 Members Statements in multiple parts are only members declared in various parts Union. The content of all parts of the type declaration share the same declaration space (§3.3), and the scope of each member (§3.7) extends to all parts. All accessible domains of any member always contain all parts of the closed type; private members declared in a part can be accessed at another part. Declaring the same member in a plurality of parts of a type will cause compile time errors unless the member is a member with a Partial modifier. Partial class a {int x; // error, not a number of X Partial Class Inner // OK, INNER is incomplete type {int y;}} Partial class a {int x; // error, no multiple declaration X Partial Class Inner // OK, Inner is incomplete type {Int z;}} Although the order of a member is not too important for C # code, it may be important when facing other languages and the environment. In this case, the order within the type declared in multiple portions will be undefined. 23.2 Name Bind Although each part of the scalable type must be declared in the same namespace, these parts can also be written in different namespaces. To this end, different USING instructions (§9.3) can be used for each portion. When the simple name (7.5.2) is explained in a portion, only the namespace of the namespace containing the part is considered. This will cause the same identifier in different parts to represent different meaning. Namespace n {using list = system.collections.ArrayList; Partial class a {list x; // x has type system.collections.arraylist}} namespace n {using list = widgets.linkedList; Partial Class A {List Y; // Y has type widgets.LinkedList}}