- PHP pathinfo() 函数
- SEO关键词分类及选择举例
- 2019年度杭州十大电商运营公司发布 解析中国电商运营发展趋势
- Mysql_Navicat建库之字符集&排序规则简介
- jQuery方法大全
- 颜色大全:颜色名称和颜色值。色板、色板对照表1
- VS2010是否支持Html5
- 简单的精华代码集
- sql语句中怎样比较两个日期的大小
- ASP.NET前台代码绑定后台变量方法总结
邮箱:
手机:15383239821
c#中list.Find、 list.FindAll 、list.FindIndex用法

protected void Page_Load(object sender, EventArgs e)
{
List<User> list = new List<User>();
list.Add(new User(1, "testOne"));
list.Add(new User(2, "testTwo"));
list.Add(new User(3, "testThree"));
list.Add(new User(4, "testTwo"));
User user1 = list.Find(p =>p.name.Equals("testTwo"));
string aa= list.Find((User uu) => uu.name.Equals("testTwo")).ToString();
List<User> listfind = list.FindAll(p => p.name == "testTwo");
for(int i=0;i<listfind.Count;i++)
{
Response.Write(listfind[i].id + "," + listfind[i].name + "<br>");
}
Response.Write("<br><br>");
int imatch = list.FindIndex(a => a.name == "testThree"); //查找是否存在叫"testThree"的人,返回list中有位置,注意:这里的位置并不是数据的id
Response.Write("所在位置为:"+imatch);
}
class User
{
int _id;
string _name;
public User(int id, string name)
{
_id = id;
_name = name;
}
public int id
{
set { _id = value; }
get { return _id; }
}
public string name
{
set { _name = value; }
get { return _name; }
}
}
-
2013-11-22.net中sql语句的安全性
-
2014-06-13String.split()采用特殊符号进行分割的解决方法
-
2010-07-20伪静态下不能使用FCKeditor的解决方案
-
2014-02-24标签列表(字母排序)
-
2010-08-03js表格字段排序
-
2013-11-22asp.net跳转页面的三种方法比较
