我正在使用列表,我的列表有14条记录.
List<Product> oProduct = new List<Product>
{
new Product("../images/1.jpg", "Sample Data.1"),
new Product("../images/2.jpg", "Sample Data.2"),
new Product("../images/3.jpg", "Sample Data.3"),
new Product("../images/4.jpg", "Sample Data.4"),
new Product("../images/5.jpg", "Sample Data.5"),
new Product("../images/6.jpg", "Sample Data.6"),
new Product("../images/7.jpg", "Sample Data.7"),
new Product("../images/8.jpg", "Sample Data.8"),
new Product("../images/9.jpg", "Sample Data.9"),
new Product("../images/10.jpg", "Sample Data.10"),
new Product("../images/11.jpg", "Sample Data.11"),
new Product("../images/12.jpg", "Sample Data.12"),
new Product("../images/13.jpg", "Sample Data.13"),
new Product("../images/14.jpg", "Sample Data.14"),
};
Run Code Online (Sandbox Code Playgroud)
当我使用下面的行为getrange然后我得到索引越界错误.
List<Product> xProduct = oProduct.GetRange(10, 13);
Run Code Online (Sandbox Code Playgroud)
但我的清单有14个元素,那么为什么我无法从第10位到第14位提取数据....请指导谢谢.
c# ×1