汗一下,.Net的单维数组自动实现IList<T>接口

今天才在msdn上发现:

In C# 2.0, single-dimensional arrays that have a lower bound of zero automatically implement IList<T>. This enables you to create generic methods that can use the same code to iterate through arrays and other collection types. This technique is primarily useful for reading data in collections. The IList<T> interface cannot be used to add or remove elements from an array; an exception will be thrown if you attempt to call an IList<T> method such as RemoveAt on an array in this context
版权所有,欢迎转载
原文地址:https://www.cnblogs.com/xiaotie/p/1608422.html