本文整理汇总了C#中System.Linq.IntersectionCount方法的典型用法代码示例。如果您正苦于以下问题:C# System.Linq.IntersectionCount方法的具体用法?C# System.Linq.IntersectionCount怎么用?C# System.Linq.IntersectionCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq
的用法示例。
在下文中一共展示了System.Linq.IntersectionCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IntersectionCount_OuterStrictLowerBounds
public void IntersectionCount_OuterStrictLowerBounds()
{
var ranges = new[] { Range(0, 5, true), Range(1, 4) };
var intersectionCounts = ranges.IntersectionCount().ToList();
intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 1, true)));
intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0], ranges[1] }, Range(1, 4)));
intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(4, 5)));
}
示例2: IntersectionCount_Gaps
public void IntersectionCount_Gaps()
{
var ranges = new[] { Range(0, 5), Range(7, 10) };
var intersectionCounts = ranges.IntersectionCount().ToList();
intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 5)));
intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new INumberRange<int>[0], Range(5, 7)));
intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[1] }, Range(7, 10)));
}
示例3: IntersectionCount_InnerNonStrictUpperBounds
public void IntersectionCount_InnerNonStrictUpperBounds()
{
var ranges = new[] { Range(0, 5), Range(1, 4, false, false) };
var intersectionCounts = ranges.IntersectionCount().ToList();
intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 1)));
intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0], ranges[1] }, Range(1, 4, false, false)));
intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(4, 5, true)));
}
示例4: IntersectionCount
public void IntersectionCount()
{
var ranges = new[] { Range(0, 5), Range(1, 4) };
var intersectionCounts = ranges.IntersectionCount().ToList();
intersectionCounts[0].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(0, 1)));
intersectionCounts[1].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0], ranges[1] }, Range(1, 4)));
intersectionCounts[2].Should().Be(new NumberRangeIntersectionCount<int>(new[] { ranges[0] }, Range(4, 5)));
}