DataTable AsEnumerable 的使用

 var p = DataTable.AsEnumerable().Where(t => t.Field<int>("ChannelID") == int.Parse(code)).Select(d => d);
        if (p != null && p.Count() > 0)
        {
            return p.Select(c => c.Field<string>("name")).First();
        }
        else
        {
            return "";
        }
原文地址:https://www.cnblogs.com/Yellowshorts/p/3564642.html