有的时候,我们只需要从老数据中拿一部分数据作为新的绑定数据,比如说绑定下拉框的时候需要构造我们需要的数据格式可以采用以下的方法 public class SelectDataViewModel { public int Key { get; set; } public string Text { get; set; } } var result = oldList.Select(x => new SelectDataViewModel() { Key = x.Id, Text = x.Name
using System; using System.Collections.Generic; using System.Linq; namespace CSharpDemo { class Program { static void Main(string[] args) { List<TestClass> MyList = new List<TestClass>(); MyList.Add(new TestClass("AAA")); MyList.Add(
select * from bdcdj.lqentry1 a where 顺序号 in (select max(顺序号) from bdcdj.lqentry1 b WHERE b.archival_code IS NOT NULL group by archival_code): 通过archival_code分组 ,取顺序号的最大值.