Skip to main content

Posts

Showing posts from November, 2014

How can we identify partial classes in C#?

The class declaration with the keyword partial is denoting that the class is a partial class. Physically the partial classes can be available in different files/locations. The C# compiler treat them as a single class at the time of compilation.           public partial class PartialClassExample         {             public void MethodOne( int input)             {                 /// Do something .             }         }         public partial class PartialClassExample         {             public string MethodTwo( string input)             {                 return string .Format( "Hello, {0}" , input);             }         } The PartialClassExample can be sit in different files but at the time of compilation they will be merged together. Hope this helps!