List<Model.PerformanceTrack> perf = TableToEntity<Model.PerformanceTrack>(TimeDt);
List<Model.PerformanceTrack> perf1 = TableToEntity<Model.PerformanceTrack>(DyDt);
我有这两个list,里面是一样的,现在需要把这两个合并成一个,并且按照时间来合并
9 个解决方案
#1
按照时间来合并 什么意思?
#2
你是想合并出来后的结果只有时间是吧?
var result= perf.Concat(perf1).Select(x => x.时间);
#3
public partial class PerformanceTrack
{
public PerformanceTrack()
{ }
#region Model
private string _name;
private string _Begintime;
private int _PhotoAddrid;
private string _CourseName;
/// <summary>
///
/// </summary>
public string Name
{
set { _name = value; }
get { return _name; }
}
/// <summary>
///
/// </summary>
public string Begintime
{
set { _Begintime = value; }
get { return _Begintime; }
}
/// <summary>
///
/// </summary>
public int PhotoAddrId
{
set { _PhotoAddrid = value; }
get { return _PhotoAddrid; }
}
/// <summary>
///
/// </summary>
public string CourseName
{
set { _CourseName = value; }
get { return _CourseName; }
}
#endregion Model
}
就是说我需要按照里面的Begintime的前后顺序来合并两个list,合并后是按照时间生成的
#4
perf.Concat(array1).OrderBy(p=>p.Begintime);
#5
var perf=perf1.Union(perf1);
#6
perf.AddRange(perf1).Select(x => x.时间)
#7
var perf=perf1.Union(perf2);
#8
mark
#9
用List<T>本身提供的方法union2个list,会帮你过滤重复。
#1
按照时间来合并 什么意思?
#2
你是想合并出来后的结果只有时间是吧?
var result= perf.Concat(perf1).Select(x => x.时间);
#3
public partial class PerformanceTrack
{
public PerformanceTrack()
{ }
#region Model
private string _name;
private string _Begintime;
private int _PhotoAddrid;
private string _CourseName;
/// <summary>
///
/// </summary>
public string Name
{
set { _name = value; }
get { return _name; }
}
/// <summary>
///
/// </summary>
public string Begintime
{
set { _Begintime = value; }
get { return _Begintime; }
}
/// <summary>
///
/// </summary>
public int PhotoAddrId
{
set { _PhotoAddrid = value; }
get { return _PhotoAddrid; }
}
/// <summary>
///
/// </summary>
public string CourseName
{
set { _CourseName = value; }
get { return _CourseName; }
}
#endregion Model
}
就是说我需要按照里面的Begintime的前后顺序来合并两个list,合并后是按照时间生成的
#4
perf.Concat(array1).OrderBy(p=>p.Begintime);
#5
var perf=perf1.Union(perf1);
#6
perf.AddRange(perf1).Select(x => x.时间)
#7
var perf=perf1.Union(perf2);
#8
mark
#9
用List<T>本身提供的方法union2个list,会帮你过滤重复。