Destination Array not long enough?

后端 未结 4 1329
不知归路
不知归路 2020-12-08 13:07

I have a class with the following method:

public List bikesCopy 
{
     get 
     { 
       List bs;
       lock (_bikes) bs = new Li         


        
4条回答
  •  时光取名叫无心
    2020-12-08 13:49

    Well you could try:

    using System.Linq; //ToList() is an extension function defined here
    ...
    lock(_bikes)
        return _bikes.ToList();
    

    The details of the exception are discussed here: Why doesn't a foreach loop work in certain cases?

提交回复
热议问题