I searched over net but didn't find any useful information about Constraints/rules while defining a partial class, I mean can all class can be named Partial or some class cannot be? can static class can be partial and all these stuffs, Please explain it well
I was asked this q in and interview and i didn't had any answer. I would really like to know this in depth, Hoe ever i found some rules in msdn for defining partial methods like

1. Partial method declarations must begin with the contextual keyword
2. partial and the method must return void.
3. Partial methods can have ref but not out parameters.
4. Partial methods are implicitly private, and therefore they cannot be virtual.
5. Partial methods cannot be extern , because the presence of the body determines whether they are defining or implementing.
6. Partial methods can have static and unsafe modifiers.
7. Partial methods can be generic.
8. Constraints are put on the defining partial method declaration, and
may optionally be repeated on the implementing one.
9. Parameter and type parameter names do not have to be the same in the
implementing declaration as in the defining one.
10. You can make a delegate to a partial method that has been defined and implemented, but not to a partial method that has only been defined.

GUYS please see m asking about the constraints/rule for partial class.. i know what partial class is for.. eg. can we add partial to static class something like that... on what points i cannot declare class as partial..
–
MayurJun 21 '12 at 11:48

honestly I would avoid the partial keyword at all costs. It exists because VS/MS wanted a way to auto-generate code and still allows the developer to add their own custom logic.

Mainly Win/WebForms. you can drag and drop controls onto the screen and use the property window to configure the object. you can then open up the "code behind" and add your own logic with full access to all the controls you added via WYSIWYG.

other than that, partials make it very easy to create more problems than they solve. It too easy to create procedural god classes that appear as though it is object oriented code.

The partial modifier indicates that additional parts of the type declaration may exist elsewhere, but the existence of such additional parts is not a requirement; it is valid for a type with a single declaration to include the partial modifier.

All parts of a partial type must be compiled together such that the parts can be merged at compile-time into a single type declaration. Partial types specifically do not allow already compiled types to be extended.

Nested types may be declared in multiple parts by using the partial modifier. Typically, the containing type is declared using partial as well, and each part of the nested type is declared in a different part of the containing type.

The partial modifier is not permitted on delegate or enum declarations.

Attributes

The attributes of a partial type are determined by combining, in an unspecified order, the attributes of each of the parts. If an attribute is placed on multiple parts, it is equivalent to specifying the attribute multiple times on the type. For example, the two parts:

When a partial type declaration includes an accessibility specification (the public, protected, internal, and private modifiers) it must agree with all other parts that include an accessibility specification. If no part of a partial type includes an accessibility specification, the type is given the appropriate default accessibility (§3.5.1).

Type parameters and constraints

If a generic type is declared in multiple parts, each part must state the type parameters. Each part must have the same number of type parameters, and the same name for each type parameter, in order.

When a partial generic type declaration includes constraints (where clauses), the constraints must agree with all other parts that include constraints. Specifically, each part that includes constraints must have constraints for the same set of type parameters, and for each type parameter the sets of primary, secondary, and constructor constraints must be equivalent. Two sets of constraints are equivalent if they contain the same members. If no part of a partial generic type specifies type parameter constraints, the type parameters are considered unconstrained.

is correct because those parts that include constraints (the first two) effectively specify the same set of primary, secondary, and constructor constraints for the same set of type parameters, respectively.