0

I extended a concrete class as below

public static string ToMyString(this IInterface obj)
{
   return "some string";
}

and I am able to call above extension on concrete reference like this

Concrete c = new Concrete();    // Concrete is an implementer of IInterface
c.ToMyString();

Same way I created another extension like

public static string ToMyString(this List<IInterface> obj)
{
   return "some string";
}

But I am not able to call this in same way as I did for single concrete object

List<Concrete> c = new List<Concrete>();    
c.ToMyString(); 

It's a compile time error!

Ashok Damani
  • 3,896
  • 4
  • 30
  • 48

0 Answers0