Partial Classes
Partial types feature is one of the important feature in dotnet framework. Using this we can define single class in multiple places or multiple files also. At the time of compilation all these classes are combine and work as a single class.For delegate and enumeration this partial modifier is not available.
Example
class Program:derivedClass { static void Main(string[] args) { derivedClass objDerived = new derivedClass(); objDerived.ExamplePartial(); } } public partial class PartialClassExample { public void GetRollNo() { Console.WriteLine("this is first part of partial class"); } } public partial class PartialClassExample { public void GetStudentName() { Console.WriteLine("this is second part of partial class"); } } public class derivedClass : PartialClassExample { public void ExamplePartial() { GetRollNo(); GetStudentName(); Console.WriteLine("this is derived class"); Console.ReadLine(); } }
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.