现在没有总结什么,也没有系统想过,只不过在csdn上面看一个朋友有点问题自己就拿今天学的linq给试了一下,呵呵, 具体linq怎么好我就不多说了,大家都知道,其实我还不知道呀,呵呵,慢慢来吧,今天做了个例子,没有什么不同之处呀,为了记住自己学了所以先在这记下来,今天也是来了郑州第八天吧,算上回家,前几天投的简历,这两天全都打电话了,不过晚了,哥找到工作了,呵呵,下次在合作吧!
string[] list = { "adobe", "excel", "acer", "query", "async", "xianfen", "apple", "amazon", "player", "best", "wow" };
List<student> students = new List<student>
{
new student { Name="是男人", Gender="男" },
new student { Name="男人", Gender="男" },
new student { Name="是", Gender="男" },
new student { Name="人色", Gender="男" },
new student { Name="是打开的附件人", Gender="男" },
new student { Name="地方", Gender="男" },
new student { Name="都是人废物", Gender="男" },
new student { Name="出色的额", Gender="男" }
};
var result = from word in list
where word.Contains("a")
orderby word ascending
select word ;
var resultName = from studentInfo in students
where studentInfo.Name.Contains("男") //("的")
orderby studentInfo.Name ascending
select studentInfo.Name;
foreach (var person in result)
{
Response.Write( person + "<br>");
}
foreach (var item in resultName)
{
Response.Write(item + "<br>");
}
}
public class student
{
public string Name;
public string Gender;
}
这种写法我还真有点不适应呢,呵呵,不过好向好东西看齐呀.
检索数据非常快,以后会试着用用了! 希望正学着的带上我一块呀,没学的咱们开始学,呵呵.