Definition : A class defined in two or more files is called a partial class. The
keyword partial is used to define the class. When working on large
projects, spreading a class over separate files allows multiple
programmers to work on it simultaneously. During compile time all the
partial class are compiled into one type only.
public partial class PartialClass
{
public void MethodA()
{
Console.WriteLine("I am A!");
}
}
public partial class PartialClass
{
public void MethodB()
{
Console.WriteLine("I am B!");
}
}
If we try to call methods of this class we can see something like this on screen.
public partial class PartialClass
{
public void MethodA()
{
Console.WriteLine("I am A!");
}
}
public partial class PartialClass
{
public void MethodB()
{
Console.WriteLine("I am B!");
}
}
If we try to call methods of this class we can see something like this on screen.
No comments:
Post a Comment