Adsence750x90

Friday, May 22, 2009

Partial Classes in C#.Net - examples usage definition

Definition :Partial types are allow to define a single class in multiple files (more than one file), when compilation time theses classes are combined to form a single class.

The partial modifier is not available on delegate or enumeration declarations.

Example
//partial class


public partial class Student

{
public virtual void GetRollNo();
}

public partial class Student
{
public virtual void GetStudentName();
}

//Derived class

public class School : Student
{
public void getStudentDetails()
{
GetRollNo();
getStudentDetails();
}
}

6 comments:

Jasmin Akther Suma said...

very nice example and too easy to understand.

Jasmin Akther Suma said...

Very nice example and too easy to understand.

Anonymous said...

Really superb

Anonymous said...

Really superb

Basit farooq said...

Very Good example

tom thopper said...

good one!!
very neatly explained,
it may also help u:
Partial class in C#.Net