1
Reply

Why class containing extension method needs to be static ?

Kg P

Kg P

Apr 15 2017 4:24 AM
245
As we understand that when we create extension method on any type, we create it
as static method. But, class containing this extension method is also needs to be
static, otherwise we get compile time error. I didn't get proper answer for this
why this class should be static in this case?
Only for accessing static method, we don't need static class. That we can de even
if class is non-static i.e. we can access that static method by
ClassName.MethodName(). But, why this class is to be static in this case?
Can someone please answer this?

Answers (1)