I am trying to cast List into IList, but unable to cast. Compiler allow me to cast it only into IEnumerable:
//Not allowed, why?
public override IList<ILineEntity> Lines
{
get { return _PharamaLines ?? (_PharamaLines = new List<PharamaLine>()); }
}
//Allowed
public override IEnumerable<ILineEntity> Lines
{
get { return _PharamaLines ?? (_PharamaLines = new List<PharamaLine>()); }
}
PharamaLine
is of type ILineEntity
.
Error: Cannot implicitly convert type '
System.Collections.Generic.List<FW.PharamaLine>
' to 'System.Collections.Generic.IList<Foundation.Interfaces.ILineEntity>
'. An explicit conversion exists (are you missing a cast?)