本文整理汇总了C#中RangeCollection.AddRangeSpecifier方法的典型用法代码示例。如果您正苦于以下问题:C# RangeCollection.AddRangeSpecifier方法的具体用法?C# RangeCollection.AddRangeSpecifier怎么用?C# RangeCollection.AddRangeSpecifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RangeCollection
的用法示例。
在下文中一共展示了RangeCollection.AddRangeSpecifier方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultipleNumbers
public void MultipleNumbers()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("5,7,9,5");
RangeCollectionTests.AssertContains(new[] { 5, 7, 9 }, range, "range");
}
示例2: SingleNumber
public void SingleNumber()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("5");
RangeCollectionTests.AssertContains(new[] { 5 }, range, "range");
}
示例3: All
public void All()
{
var range = new RangeCollection(1, 10);
range.AddRangeSpecifier("*");
RangeCollectionTests.AssertContains(
new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, range, "range");
}
示例4: RangeWithStep
public void RangeWithStep()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("10-20/3");
RangeCollectionTests.AssertContains(
new[] { 10, 13, 16, 19 }, range, "range");
}
示例5: Range
public void Range()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("10-20");
RangeCollectionTests.AssertContains(
new[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }, range, "range");
}
示例6: AddRange
private void AddRange(RangeCollection collection, string specifier, string name)
{
try
{
collection.AddRangeSpecifier(specifier);
}
catch (Exception ex)
{
throw new ArgumentException("Unable to process " + name + " specifier: " + ex.Message, ex);
}
}
示例7: AllWithStep
public void AllWithStep()
{
var range = new RangeCollection(1, 10);
range.AddRangeSpecifier("*/2");
RangeCollectionTests.AssertContains(
new[] { 1, 3, 5, 7, 9 }, range, "range");
}
示例8: EmptyStringThrows
public void EmptyStringThrows()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("");
}
示例9: NumberWithRangeThrows
public void NumberWithRangeThrows()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("1/5");
}
示例10: MixedRange
public void MixedRange()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("5,10-13,15-20/2,*/10");
RangeCollectionTests.AssertContains(
new[] { 1, 5, 10, 11, 12, 13, 15, 17, 19, 21, 31, 41 }, range, "range");
}
示例11: OverlappingRangesWithStep
public void OverlappingRangesWithStep()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("10-20/3,11-19/2");
RangeCollectionTests.AssertContains(
new[] { 10, 11, 13, 15, 16, 17, 19 }, range, "range");
}
示例12: MultipleRangesWithStep
public void MultipleRangesWithStep()
{
var range = new RangeCollection(1, 50);
range.AddRangeSpecifier("4-8,25-27,10-20/4");
RangeCollectionTests.AssertContains(
new[] { 4, 5, 6, 7, 8, 10, 14, 18, 25, 26, 27 }, range, "range");
}