C#:返回的IEnumerable时,字段不为空? [英] C#: Return IEnumerable when field is not null?
本文介绍了C#:返回的IEnumerable时,字段不为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public IEnumerable GetAddress()
{
DataSet ds = DataOps.GetDataSet(string.Format(" select * from Students"));
DataTable dt = ds.Tables[0];
// What goes here?
}
我需要使用方法的IEnumerable
I need to use IEnumerable methods
我怎样才能返回一个包含有地址的所有学生的DataRows枚举只?
How can i return enumeration of DataRows containing all students that have addresses only?
推荐答案
我觉得你在找什么是
DataRow[] dr = ds.Tables[0].Select("Address NOT NULL"); // you want filtering on address column
foreach (DataRow row in dr)
{
}
这篇关于C#:返回的IEnumerable时,字段不为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文