本文整理汇总了C#中RangeCollection.FindRangeIndexForValue方法的典型用法代码示例。如果您正苦于以下问题:C# RangeCollection.FindRangeIndexForValue方法的具体用法?C# RangeCollection.FindRangeIndexForValue怎么用?C# RangeCollection.FindRangeIndexForValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RangeCollection
的用法示例。
在下文中一共展示了RangeCollection.FindRangeIndexForValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NegativeIndices
public void NegativeIndices ()
{
RangeCollection c = new RangeCollection ();
c.Add (-10);
c.Add (-5);
c.Add (5);
c.Add (-8);
c.Add (10);
c.Add (-9);
c.Add (-11);
Assert.IsTrue (c.Contains(-10), "#1");
Assert.IsTrue (c.Contains(-5), "#2");
Assert.IsTrue (c.Contains(5), "#3");
Assert.IsTrue (c.Contains(-8), "#4");
Assert.AreEqual (4, c.RangeCount, "#5");
Assert.AreEqual (new RangeCollection.Range (-11, -8), c.Ranges[0], "#6");
Assert.AreEqual (new RangeCollection.Range (-5, -5), c.Ranges[1], "#7");
Assert.AreEqual (new RangeCollection.Range (5, 5), c.Ranges[2], "#8");
Assert.AreEqual (new RangeCollection.Range (10, 10), c.Ranges[3], "#9");
Assert.AreEqual (0, c.FindRangeIndexForValue (-9), "#10");
Assert.IsTrue (c.FindRangeIndexForValue (-7) < 0, "#11");
}