Posts

Showing posts from January, 2019

Partial class in C#

Lets think a situation that Visual Studio gave you some auto generated classes as per your request. Now you need to append some methods or member variables to this class for satisfying your requirement. What to do now? The solution is: you have to customize that class appending to the previous auto generated one. but we know that it should not be the right way to edit an auto generated class. Because if you modify any auto generated part, the code may malfunction. Authority invent a way that you will write your modification totally in a new source file  but during compile time it will be merged with that auto generated class. So the auto generated class is kept untouched or safe. Since both of these parts combined create an ultimate class, these parts of classes are defined as partial class.