本文整理汇总了C#中System.Collections.SortedSet.GetViewBetween方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.GetViewBetween方法的具体用法?C# SortedSet.GetViewBetween怎么用?C# SortedSet.GetViewBetween使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.SortedSet
的用法示例。
在下文中一共展示了SortedSet.GetViewBetween方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewUnionWith_oor
public void ViewUnionWith_oor ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (4, 8);
view.UnionWith (new [] {1});
}
示例2: ViewSymmetricExceptWith
public void ViewSymmetricExceptWith ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (4, 8);
view.SymmetricExceptWith (new [] { 4, 5, 6, 6, 4 });
Assert.IsTrue (view.SequenceEqual (new [] { 4, 6, 7 }));
Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 4, 6, 7, 9 }));
}
示例3: ViewCount
public void ViewCount ()
{
var set = new SortedSet<int> { 1, 3, 4, 5, 6, 7, 8, 9 };
var view = set.GetViewBetween (4, 8);
Assert.AreEqual (5, view.Count);
set.Remove (5);
Assert.AreEqual (4, view.Count);
set.Add (10);
Assert.AreEqual (4, view.Count);
set.Add (6);
Assert.AreEqual (4, view.Count);
set.Add (5);
Assert.AreEqual (5, view.Count);
}
示例4: ViewIntersectWith
public void ViewIntersectWith ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (4, 8);
view.IntersectWith (new [] { 1, 5, 9 });
Assert.IsTrue (view.SequenceEqual (new [] { 5 }));
Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 5, 9 }));
view.IntersectWith (new [] { 1, 2 });
Assert.IsTrue (view.SequenceEqual (new int [] {}));
Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 9 }));
}
示例5: ViewMin
public void ViewMin ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (4, 8);
Assert.AreEqual (5, view.Min);
view = set.GetViewBetween (-2, 4);
Assert.AreEqual (1, view.Min);
view = set.GetViewBetween (1, 9);
Assert.AreEqual (1, view.Min);
}
示例6: ViewMax
public void ViewMax ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (4, 8);
Assert.AreEqual (7, view.Max);
view = set.GetViewBetween (4, 55);
Assert.AreEqual (9, view.Max);
view = set.GetViewBetween (1, 9);
Assert.AreEqual (9, view.Max);
}
示例7: ViewGetView
public void ViewGetView ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (3, 7);
view = view.GetViewBetween (4, 6);
Assert.IsTrue (view.SequenceEqual (new [] { 5 }));
}
示例8: GetViewBetweenLowerBiggerThanUpper
public void GetViewBetweenLowerBiggerThanUpper ()
{
var set = new SortedSet<int> { 1, 2, 3, 4, 5, 6 };
set.GetViewBetween (4, 2);
}
示例9: ViewClear
public void ViewClear ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (3, 7);
view.Clear ();
Assert.AreEqual (0, view.Count);
Assert.IsTrue (set.SequenceEqual (new [] { 1, 9 }));
}
示例10: ViewGetViewUpperOutOfRange
public void ViewGetViewUpperOutOfRange ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (3, 7);
view.GetViewBetween (5, 9);
}
示例11: ViewRemove
public void ViewRemove ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (3, 7);
Assert.IsTrue (view.Remove (3));
Assert.IsFalse (view.Contains (3));
Assert.IsFalse (set.Contains (3));
Assert.IsFalse (view.Remove (9));
Assert.IsTrue (set.Contains (9));
}
示例12: ViewAddOutOfRange
public void ViewAddOutOfRange ()
{
var set = new SortedSet<int> { 1, 3, 5, 7 };
var view = set.GetViewBetween (3, 5);
view.Add (7);
}
示例13: ViewAdd
public void ViewAdd ()
{
var set = new SortedSet<int> { 1, 3, 5, 7 };
var view = set.GetViewBetween (3, 5);
Assert.IsTrue (view.Add (4));
Assert.IsTrue (view.Contains (4));
Assert.IsTrue (set.Contains (4));
Assert.IsFalse (view.Add (5));
}
示例14: ViewSymmetricExceptWith_oor
public void ViewSymmetricExceptWith_oor ()
{
var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
var view = set.GetViewBetween (4, 8);
view.SymmetricExceptWith (new [] {2});
}
示例15: EmptySubView
void EmptySubView (SortedSet<int> set)
{
var view = set.GetViewBetween (-20, -15);
Assert.AreEqual (0, view.Count);
Assert.AreEqual (0, view.Min);
Assert.AreEqual (0, view.Max);
view = set.GetViewBetween (15, 20);
Assert.AreEqual (0, view.Count);
Assert.AreEqual (0, view.Min);
Assert.AreEqual (0, view.Max);
}