BillWoodruff wrote:Why do these compile ?
"The as operator is like a cast operation. However, if the conversion is not possible, as returns null instead of raising an exception." link to the "as" operator in msdn[^]
so, what happens is that the compiler doesn't care if your conversion always returns null.
i'm trying to instal the .net sdk in this computer (don't have admin privileges) to disassemble a dll and see what code the compiler generates for
List<IGenericInterface> and for
List<UsingGenericInterface> but i suppose that the
IEnumerable<UsingGenericInterface> and, given that
List<UsingGenericInterface> also implements
if this is the case, then i think it's a design flaw of the compiler, but i wont take precipitated conclusions.