什么是List<>在C#中 [英] what is List<> in C#
本文介绍了什么是List<>在C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C#中的List是什么? 。请描述清单<>进入c#im混淆使用列表到asp.net的正确方法mvc3
what is List in C# ? . please describe the list<> into c# i m confused what is the correct way to use list into asp.net mvc3
推荐答案
甚至还有关于参数的交互式教程,例如:列表 [ ^ ]。
There are even interactive tutorials on the argument, see, for instance: "Lists"[^].
简而言之:列表< T> [ ^ ]表示可以通过索引访问的强类型对象列表;提供搜索,排序和操作数据的方法。
有可能创建几个列表,例如:
a)字符串列表
In a short: List<T>[^] represents a strongly typed list of objects that can be accessed by index; provides methods to search, sort, and manipulate data.
There is possible to create several lists, such as:
a) list of string
List<string> stringlist = new List<string>(){"a", "b", "e"};</string></string>
b)整数列表
b) list of integers
List<int> intlist = new List<int>(){1, 3, 7};</int></int>
甚至
c)自定义类:
and even
c) custom class:
public class Car
{
private string sName = string.Empty;
//clas constructor
public Car(string _name)
{
sName = _name;
}
}
List<Car> cars = new List<Car>(){new Car("VW"), new Car("BMW")};
等
请阅读文档。
etc.
Please, read the documentation.
这篇关于什么是List<>在C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文