当前位置: 首页>>代码示例>>C#>>正文


C# Range.Intersect方法代码示例

本文整理汇总了C#中Range.Intersect方法的典型用法代码示例。如果您正苦于以下问题:C# Range.Intersect方法的具体用法?C# Range.Intersect怎么用?C# Range.Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Range的用法示例。


在下文中一共展示了Range.Intersect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Intersect_ShouldReturnIntersection_WhenExists

 public void Intersect_ShouldReturnIntersection_WhenExists()
 {
     var range = new Range<int>(0, 3);
     var other = new Range<int>(2, 4);
     Assert.AreEqual(new Range<int>(2, 3), range.Intersect(other));
     
 }
开发者ID:david--liu,项目名称:code_kata,代码行数:7,代码来源:RangeTest.cs

示例2: ShouldSupportDecimal

 public void ShouldSupportDecimal()
 {
     var range = new Range<decimal>(0.1m, 3.1m);
     var other = new Range<decimal>(2.1m, 4);
     Assert.AreEqual(new Range<decimal>(2.1m, 3.1m), range.Intersect(other));
     
 }
开发者ID:david--liu,项目名称:code_kata,代码行数:7,代码来源:RangeTest.cs

示例3: IntersectShouldIntersect

		public void IntersectShouldIntersect(int s1, int e1, int s2, int e2, int s, int e)
		{
			var r1 = new Range<int>(s1, e1);
			var r2 = new Range<int>(s2, e2);
			var r = e >= 0 ? (Range<int>?)new Range<int>(s, e) : null;
			Assert.AreEqual(r, r1.Intersect(r2));
			Assert.AreEqual(r, r2.Intersect(r1));
		}
开发者ID:picoe,项目名称:Eto,代码行数:8,代码来源:RangeTests.cs

示例4: Intersection

 public void Intersection()
 {
     var r1 = new Range<int>(10, 20);
     var r2 = new Range<int>(15, 25);
     var intersection = r1.Intersect(r2);
     Assert.AreEqual(15, intersection.Start);
     Assert.AreEqual(20, intersection.End);
 }
开发者ID:avgx,项目名称:OrigoDB,代码行数:8,代码来源:RangeTests.cs

示例5: Intersect_ShouldReturnNull_WhenNoIntersection

 public void Intersect_ShouldReturnNull_WhenNoIntersection()
 {
     var range = new Range<int>(0, 10);
     var other = new Range<int>(20, 30);
     Assert.IsNull(range.Intersect(other));
 }
开发者ID:david--liu,项目名称:code_kata,代码行数:6,代码来源:RangeTest.cs

示例6: IntersectThrowsException

 public void IntersectThrowsException(Range nonOverlappingRange)
 {
     Assert.Throws<ArgumentOutOfRangeException>(() => nonOverlappingRange.Intersect(TargetRange));
     Assert.Throws<ArgumentOutOfRangeException>(() => TargetRange.Intersect(nonOverlappingRange));
 }
开发者ID:rpmoore,项目名称:ds3_net_sdk,代码行数:5,代码来源:TestRange.cs

示例7: IntersectReturnsCommonRangeParts

 public void IntersectReturnsCommonRangeParts(Range input, Range output)
 {
     Assert.AreEqual(output, TargetRange.Intersect(input));
     Assert.AreEqual(output, input.Intersect(TargetRange));
 }
开发者ID:rpmoore,项目名称:ds3_net_sdk,代码行数:5,代码来源:TestRange.cs

示例8: GetIntersection

        public void GetIntersection()
        {
            var range = new Range<int>(3, 6);
            Range<int> intersection = range.Intersect(new Range<int>(5, 8));

            Assert.AreEqual(5, intersection.Start);
            Assert.AreEqual(6, intersection.End);
        }
开发者ID:AllenConway,项目名称:SpackleNet,代码行数:8,代码来源:RangeTests.cs

示例9: GetIntersectionWithNoIntersection

 public void GetIntersectionWithNoIntersection()
 {
     var range = new Range<int>(3, 6);
     Assert.IsNull(range.Intersect(new Range<int>(7, 8)));
 }
开发者ID:AllenConway,项目名称:SpackleNet,代码行数:5,代码来源:RangeTests.cs


注:本文中的Range.Intersect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。