且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法将HashSet转换为IReadOnlyCollection

更新时间:2023-02-14 10:25:19

您正在使用4.5,而Hashset却没有t实施IReadOnlyCollection,直到4.6

You're using 4.5 and Hashset doesn't implement IReadOnlyCollection until 4.6

从MSDN:


HashSet实现IReadOnlyCollection接口从.NET Framework 4.6开始;在.NET Framework的早期版本中,HashSet类未实现此接口。

HashSet implements the IReadOnlyCollection interface starting with the .NET Framework 4.6; in previous versions of the .NET Framework, the HashSet class did not implement this interface.

https://msdn.microsoft.com/zh-CN/library/bb359438(v=vs.110).aspx