我试图篡改这个名单:
private readonly IList<MyClass> myList = new List<MyClass>();
(见here):
IList<MyClass> mockList = Builder<MyClass>.CreateListOfSize(5).Build();
mockObj.SetupGet<IEnumerable<MyClass>>(o => o.myList).Returns(stakeHoldersList);
然而,在业时间 我收到了一个因瓦利德·卡斯特韦采:
Unable to cast object of type System.Collections.Generic.List`1[MyClass] to
type System.Collections.ObjectModel.ReadOnlyCollection`1[MyClass] .
我做了什么错误?