我想知道,假设我有一个 ConcurrentBag 封装在这样的对象中
class Package
{
private ConcurrentBag<string> myList;
public string title {get; private set;}
public string description {get; private set;}
public Package(string title,string description)
{
myList = new ConcurrentBag<string>();
this.title = title;
this.description = description;
}
public override string ToString()
{
return title + " " + description;
}
}
我将如何返回我的 ConcurrentBag 的只读版本?