I am confused when / why you can do this,
The return of the interface is good if you want to separate the contract from what something should do, from a specific implementation (how to do it). Having an interface allows you to reuse and change the code more easily.
IFoo SimpleFoo, IFoo , . AdvancedFoo, IFoo. , , - . , .
, . List<T>, IEnumerable<T>, . , " " (, ), .
/ ,
, . , , . . , , , .
, :
IFoo foo = getFoo();
SimpleFoo simpleFoo = (SimpleFoo)foo;
, , as:
IFoo foo = getFoo();
SimpleFoo simpleFoo = foo as SimpleFoo;
if (simpleFoo == null)
{
}
else
{
}