本文整理汇总了C#中ReadOnlyCollection.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# ReadOnlyCollection.OrderBy方法的具体用法?C# ReadOnlyCollection.OrderBy怎么用?C# ReadOnlyCollection.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadOnlyCollection
的用法示例。
在下文中一共展示了ReadOnlyCollection.OrderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertHelper
bool AssertHelper(ReadOnlyCollection<NameBindingWithFilling> oneOfTheResults, IList<Expectation> expectations)
{
//orders names by leafIndex (both of the expectation and results) and then compares whether they have the same elements (which then need to be in the same order, hence SequenceEquals suffices)
//Otherwise we have to correlate the order of both sequence we have to compare
var orderedExpectations = expectations.OrderBy(e => e.ExpectedLeafIndex);
var orderedResult = oneOfTheResults.OrderBy(match => match.Binding.Index);
var namesMatch = Enumerable.SequenceEqual(orderedExpectations.Select(e => e.ExpectedName), orderedResult.Select(m => m.Binding.Name), GloballyScopedMethods.ReferenceEqualityComparer);
var leafIndicesMatch = Enumerable.SequenceEqual(orderedExpectations.Select(e => e.ExpectedLeafIndex), orderedResult.Select(m => m.Binding.Index));
return namesMatch && leafIndicesMatch;
}
示例2: orderAllResults
//TODO: This won't be necessary when we enforce precise location
private List<RecognizedSegment> orderAllResults(ReadOnlyCollection<RecognizedSegment> results)
{
var sortedOutput = results.OrderBy(k => k.Bounds.Y).ToList();
int indiciesToAdjust = 0;
for (int i = sortedOutput.Count - 1; i >= 0; i--) {
if (i != 0 && (sortedOutput[i].Bounds.Y - sortedOutput[i - 1].Bounds.Y) < 4) {
indiciesToAdjust++;
}
else {
for (int j = 1; j <= indiciesToAdjust; j++) {
System.Drawing.Rectangle newBounds = new System.Drawing.Rectangle(sortedOutput[i + j].Bounds.X,
sortedOutput[i].Bounds.Y,
sortedOutput[i + j].Bounds.Width,
sortedOutput[i + j].Bounds.Height);
sortedOutput[i + j] = new RecognizedSegment(newBounds, sortedOutput[i + j].Text, sortedOutput[i + j].Certainty);
}
indiciesToAdjust = 0;
}
}
sortedOutput = sortedOutput.OrderByDescending(k => k.Bounds.Width)
.OrderBy(k => k.Bounds.X)
.OrderBy(k => k.Bounds.Y).ToList();
return sortedOutput;
}
示例3: RandomizedList
public static IEnumerable<Player> RandomizedList(ReadOnlyCollection<Player> players)
{
List<Player> randomPlayers = new List<Player>();
randomPlayers.AddRange(players.OrderBy(x => r.Next()).Take(players.Count));
return randomPlayers;
}