本文整理匯總了C#中Bag.OrderBy方法的典型用法代碼示例。如果您正苦於以下問題:C# Bag.OrderBy方法的具體用法?C# Bag.OrderBy怎麽用?C# Bag.OrderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bag
的用法示例。
在下文中一共展示了Bag.OrderBy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CanScanSeveralItems
public void CanScanSeveralItems()
{
var buffer = new byte[1024];
var stack = new Bag(new MemoryStream(buffer), new MemoryStream(buffer), StartMode.Create);
stack.Add(1);
stack.Add(2);
stack.Add(3);
Assert.Equal(new long[]{1,2,3}, stack.OrderBy(x=>x).ToArray());
}
示例2: CanPushSeveralItemsAndScanFromAnother
public void CanPushSeveralItemsAndScanFromAnother()
{
var buffer = new byte[1024];
var stack = new Bag(new MemoryStream(buffer), new MemoryStream(buffer), StartMode.Create);
stack.Add(1);
stack.Add(2);
stack.Add(3);
stack.Flush();
stack = new Bag(new MemoryStream(buffer)
{
Position = stack.CurrentPosition.Value
}, new MemoryStream(buffer), StartMode.Open);
Assert.Equal(new long[] { 1,2,3 }, stack.OrderBy(x=>x).ToArray());
}