lambda表态式
DataTable dtAllItems = policySecurity.GetUserAccessTypeOnAllItems(userID); List<DataRow> listItemInFunction = (from row in dtAllItems.AsEnumerable() where row.Field<int>("FunctionID") == functionID select row).ToList<DataRow>();
泛型遍历,p是一个副本(对于引用类型,是其引用地址的副本),所以对其赋值不影响原值,p = null ,不会改变pluginList中的值
List<PluginInfo> pluginList = GetSavedState(); pluginList.Where(p => p.Enabled == true).ToList().ForEach(delegate(PluginInfo p) { if (p.ID > 0) { //TO DO:
p = null; } });