This is a good idea when you want to give this implementation to any object which implement that interface, regardless of what implementation is that.
An abstract class provide that implementation only to its derived classes.
If that interface is yours, or, you have a single base-abstract class that implements that interface, and it's safe to assume that no implementations which doesn't derive from that class would be in your code - it would be a good idea to implement that functionality in that abstract class (but, you'll have to cast to that abstract class, to use that method, which makes the interface somehow redundant).
However, if you want to provide an implementation (of that method) to all types which implement that interface, regardless of their actual implementation - an extension method would be a better idea.
Moreover, a class can only derive from a single class - which means that by deriving from that abstract class, you cannot derive from any other class. So, if you'll have multiple inheritance chains which implements that interface, the only solution to provide that method to all of them (directly), without duplication of code, is via an extension (although there other solution to provider the functionality, but it wouldn't be directly: objWhichImplIFoo.Foo()
).
BTW, there is another reason to want an extension: if you want it to be callable from null
s. A declared method will always throw a NullReferenceException
if the object is null. Because extensions are actually static methods - they can be called upon nulls:
IFoo foo = null;
var something = foo.GetSomethingOrDefault();