IList to IList

后端 未结 8 1065
猫巷女王i
猫巷女王i 2021-01-05 00:28

I have a few classes:

class Vehicle
{
}

class Car : Vehicle
{
}

I have a list of the derived class: IList cars;

8条回答
  •  自闭症患者
    2021-01-05 00:47

    Note that IReadOnlyList from .NET 4.5+ will allow you to cast IReadOnlyList into IReadOnlyList with no problems. List and Collection implement this interface.

提交回复
热议问题