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

今天才在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

 

你可能感兴趣的:(.net)