What is an Extension Class?

There's no such thing as "extension class" in formal C# terminology. It might mean a class defining extension methods (which is not anything special, it's just a simple static class.)


Your teacher may also be talking about partial classes...


Technically an "extension class" is not anything. In the vernacular it could be used by someone to refer to a class that is designed to store extension methods. Extension methods are methods used to look like instance methods of a class, but which are truly static methods in a static class that are provided to enhance and encapsulate certain functionality. They are especially useful when you are trying to extend certain functionality on a type that you cannot modify directly and add a method to. Additionally, they are often used with generic types (especially within the .net 3.5 framework) to extend functionality using the methods provided by a specific interface.

Tags:

C#

.Net