本文整理汇总了C#中NTree.GetBySegment方法的典型用法代码示例。如果您正苦于以下问题:C# NTree.GetBySegment方法的具体用法?C# NTree.GetBySegment怎么用?C# NTree.GetBySegment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NTree
的用法示例。
在下文中一共展示了NTree.GetBySegment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NTreePushesLotsOfDuplicateEntities
public void NTreePushesLotsOfDuplicateEntities()
{
var objs = TestResourceFactory.GetMockClassAObjects(5000).ToList();
var seedIndex = new Seed32();
var seedSegment = new Seed64();
objs.ForEach(o => o.Id = seedIndex.Increment());
var toAdd = objs.Select(o => new Tuple<MockClassA, long>(o, seedSegment.Increment())).ToList();
using (var tree = new NTree<int, MockClassA, long>("Id"))
{
var ids = tree.AddOrUpdateRange(toAdd);
Assert.AreEqual(5000, tree.Length);
Assert.AreEqual(5, tree.GetFirstByIndex(5));
Assert.AreEqual(5, tree.GetFirstBySegment(5));
Assert.AreEqual(1, tree.GetByIndex(5).Count());
tree.AddOrUpdate(new Tuple<MockClassA, long>(TestResourceFactory.CreateRandom().WithId(seedIndex.Increment()), seedSegment.Increment()));
Assert.AreEqual(5001, tree.Length);
tree.AddOrUpdateRange(toAdd.Skip(100).Take(100).ToList());
Assert.AreEqual(5101, tree.Length);
Assert.AreEqual(2, tree.GetBySegment(toAdd[101].Item2).Count());
}
}