本文整理汇总了C#中Range.Touches方法的典型用法代码示例。如果您正苦于以下问题:C# Range.Touches方法的具体用法?C# Range.Touches怎么用?C# Range.Touches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.Touches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TouchesShouldTouch
public void TouchesShouldTouch(int s1, int e1, int s2, int e2, bool touches)
{
var r1 = new Range<int>(s1, e1);
var r2 = new Range<int>(s2, e2);
Assert.AreEqual(touches, r1.Touches(r2, i => i + 1));
Assert.AreEqual(touches, r2.Touches(r1, i => i + 1));
}
示例2: touches_range
public void touches_range() {
var a = new Range(1, 1);
var b = new Range(1, 2);
var c = new Range(2, 3);
var d = new Range(2.1, 2.9);
var e = new Range(1, 2.5);
Assert.True(a.Touches(b));
Assert.False(a.Touches(c));
Assert.True(b.Touches(a));
Assert.True(b.Touches(c));
Assert.False(c.Touches(a));
Assert.True(c.Touches(b));
Assert.False(c.Touches(d));
Assert.False(d.Touches(c));
Assert.False(c.Touches(e));
Assert.False(e.Touches(c));
}
示例3: touches_value
public void touches_value() {
var a = new Range(1, 1);
var b = new Range(1, 2);
Assert.False(a.Touches(0));
Assert.False(a.Touches(1));
Assert.False(a.Touches(2));
Assert.False(a.Touches(3));
Assert.False(b.Touches(0));
Assert.True(b.Touches(1));
Assert.False(b.Touches(1.5));
Assert.True(b.Touches(2));
Assert.False(b.Touches(3));
}