我有以下继承:
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?
}
无法将类型为“System.Collections.Generic.List1[xRow]”的对象强制转换为类型“System.Collections.Generic.IEnumerable
1[TeraRow]”
为什么需要进行强制转换呢?