I have the following inheritance:
internal abstract class TeraRow{}
internal class xRow : TeraRow {} // xRow is a child of TeraRow
public IEnumerable<TeraRow> Compare(MappedTables which, DateTime selectionStart
, DateTime selectionEnd, string pwd)
{
IEnumerable<xRow> result=CompareX();
return (IEnumerable<TeraRow>)result; //Invalid Cast Exception?
}
Unable to cast object of type 'System.Collections.Generic.List1[xRow]' to type 'System.Collections.Generic.IEnumerable
1[TeraRow]
Also why do I need to cast it at all?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…