C# 2.0 introduces the concept of partial type definitions for classes, structs, and interfaces, as a means to break types in a program into multiple pieces to be stored in different source files for easier maintenance and development. This approach is particularly useful when the need arises to use nested types or provide interface implementation
Example :
[Serializable]
Public Partial Class abc
{
int x;
}
[Dockable]
Public Partial Class abc
{
int y;
}
After Compliation the result would be
[Serializable,Dockable]
Public Partial Class abc
{
int x;
int y;
}
Partial Type Attributes
Attributes on partial types are combined in an unspecified order so that they appear to all be defined on the given typeExample :
[Serializable]
Public Partial Class abc
{
int x;
}
[Dockable]
Public Partial Class abc
{
int y;
}
After Compliation the result would be
[Serializable,Dockable]
Public Partial Class abc
{
int x;
int y;
}
No comments:
Post a Comment