Showing posts with label C# 3.5 new feature. Show all posts
Showing posts with label C# 3.5 new feature. Show all posts

Thursday, January 21, 2010

Partial Classes

allow a class to be split over multiple source files and have no effect on the intermediate code produced by the compiler.

The following are other points to keep in mind:

• Structs can use the partial modifier, but enumerations can’t.

• Assemblies form the boundaries of classes, and a partial class can’t span multiple assemblies.

• If one file marks a class as partial, all other declarations of the class must also use thepartial modifier.

• It’s legal for each partial class to add features to the class as long as they aren’t mutually exclusive.

C# 1:
Read only properties.
Weakly typed collections

C#2 :
Private property "setters".
Strongly typed collections

c# 3:
Automatically implemented properties
Enhanced collection and object intialization.