what is partial class in .net 2.0

what is partial class in .net 2.0

Single Class can be separated into multiple physical files with same logical name.

By:Deepa
Date:2024-11-09 00:00:00

Partial Class:-Using the partial keyword indicates that other parts of the class, struct, or interface can be defined within the namespace



Below is the example of a partial class.

Listing 1: Entire class definition in one file (file1.cs)

public class Node
{
    public bool Delete()
    {
    }

    public bool Create()
    {
    }
}

Listing 2: Class split across multiple files

(file1.cs)

public partial class Node
{
    public bool Delete()
    {
    }
}

(file2.cs)

public partial class Node
{
    public bool Create()
    {
    }
}




By:kamal
Date:2011-10-10 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Links

C interview questions and answers for experienced and fresher