使用Linq First()方法 [英] Use of Linq First() method

查看:351
本文介绍了使用Linq First()方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用过如下代码:

I have used a code like :

var st = (from s in db.specSheets where s.AccSlNo == int.Parse(Label1.Text) select s).First();
        descrip1.Text = st.descrip1+"<br/>"+st.descrip2;



.First()方法的功能是什么。它只检索一行或仅检索该行的第一个元素吗?请帮帮我。


What is the function of .First() method. Is it retrieve only one row or only the first element of the row? Please help me.

推荐答案

.First()方法只返回结果集的第一行。



http://msdn.microsoft.com/en-us/library /system.linq.enumerable.first.aspx [ ^ ]
The .First() method will return only the first row of your resultset.

http://msdn.microsoft.com/en-us/library/system.linq.enumerable.first.aspx[^]


这篇关于使用Linq First()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆