Assuming this object:
DXMessage
{
public byte[] msg;
public int time;
public int millisecond;
}
and assuming that I have 2 sorted lists:
public static SortedList<long, DXMessage> brimstoneMessages =
new SortedList<long, DXMessage>();
publi开发者_如何学Goc static SortedList<long, DXMessage> gpsMessages =
new SortedList<long, DXMessage>();
I have executed 2 queries on 2 different lists of messages:
var bsQuery = GlobalObjects.bsMessages.Where(t =>
((t.Value.Time >= eventStart))).ToList();
var gpsQuery = GlobalObjects.gpsMessages.Where(t =>
((t.Value.Time >= eventStart))).ToList();
I would like to take the results of these 2 queries, and join them in ascending order by Time and millisecond.
By "join" do you mean "concatenate" rather than a sort of SQL join? I suspect you just want:
var combined = bsQuery.Concat(gpsQuery)
.OrderBy(x => x.Value.time)
.ThenBy(x => x.Value.millisecond);
It's not clear why you've got so many brackets in your queries by the way - and in this case it looks like you could actually perform the combination earlier:
var combined = GlobalObjects.bsMessages
.Concat(GlobalObjects.gpsMessages)
.Where(t => t.Value.Time >= eventStart)
.OrderBy(t => t.Value.Time)
.ThenBy(t => t.Value.Millisecond);
精彩评论