When to use abstract classes instead of interfaces and extension methods in C#?
Posted
by
Gulshan
on Programmers
See other posts from Programmers
or by Gulshan
Published on 2011-01-31T09:17:14Z
Indexed on
2011/01/31
15:33 UTC
Read the original article
Hit count: 338
"Abstract class" and "interface" are similar type of ideas, while interface being more abstract. One need of abstract classes was to provide method implementations for the derived classes. But in C#, that need has also been reduced by lately introduced extension methods. So, in C#, when should we use abstract classes instead of using interfaces and extension methods associated with the interface?
And now, we can use 'Properties' in interfaces also. A notable example of interface+ extension methods is the Heavily used IEnumerable
and it's helper methods. You use Linq and it's all by this extension methods!
© Programmers or respective owner