Table of Contents

Class DateTimeRanges

Namespace
Utils.Range
Assembly
Utils.dll

Represents a collection of ranges for DateTime values, with parsing support from string representations.

public class DateTimeRanges : Ranges<DateTime>, IFormattable, IEquatable<Ranges<DateTime>>, ISubtractionOperators<Ranges<DateTime>, Ranges<DateTime>, Ranges<DateTime>>, IEqualityOperators<Ranges<DateTime>, Ranges<DateTime>, bool>
Inheritance
DateTimeRanges
Implements
Inherited Members
Extension Methods

Constructors

DateTimeRanges()

Initializes a new instance of the DateTimeRanges class with no ranges.

public DateTimeRanges()

DateTimeRanges(IEnumerable<IRange<DateTime>>)

Initializes a new instance of the DateTimeRanges class with interface-based ranges.

public DateTimeRanges(IEnumerable<IRange<DateTime>> ranges)

Parameters

ranges IEnumerable<IRange<DateTime>>

The ranges to include in the collection.

DateTimeRanges(IEnumerable<Range<DateTime>>)

Initializes a new instance of the DateTimeRanges class with ranges provided as an enumerable collection.

public DateTimeRanges(IEnumerable<Range<DateTime>> ranges)

Parameters

ranges IEnumerable<Range<DateTime>>

The ranges to include in the collection.

DateTimeRanges(Ranges<DateTime>)

Initializes a new instance of the DateTimeRanges class by copying an existing set of ranges.

public DateTimeRanges(Ranges<DateTime> ranges)

Parameters

ranges Ranges<DateTime>

The ranges to copy into this collection.

DateTimeRanges(params Range<DateTime>[])

Initializes a new instance of the DateTimeRanges class with the specified ranges.

public DateTimeRanges(params Range<DateTime>[] ranges)

Parameters

ranges Range<DateTime>[]

The ranges to include in the collection.

Methods

Add(string)

Adds ranges to the collection by parsing them from a string using the current culture.

public void Add(string ranges)

Parameters

ranges string

The string representation of the ranges to add.

Add(string, CultureInfo)

Adds ranges to the collection by parsing them from a string using a specified culture.

public void Add(string ranges, CultureInfo cultureInfo)

Parameters

ranges string

The string representation of the ranges to add.

cultureInfo CultureInfo

The culture information to use for parsing.

Add(string, DateTimeFormatInfo)

Adds ranges to the collection by parsing them from a string using a specified DateTime format.

public void Add(string ranges, DateTimeFormatInfo formatInfo)

Parameters

ranges string

The string representation of the ranges to add.

formatInfo DateTimeFormatInfo

The DateTime format information to use for parsing.

InnerParse(string, DateTimeFormatInfo)

Helper method to parse ranges from a string using specified DateTime format information.

protected static IEnumerable<IRange<DateTime>> InnerParse(string range, DateTimeFormatInfo formatInfo)

Parameters

range string

The string representation of the ranges.

formatInfo DateTimeFormatInfo

The DateTime format information to use for parsing.

Returns

IEnumerable<IRange<DateTime>>

An enumerable collection of Range<DateTime> objects parsed from the string.

Parse(string)

Parses a string representation of ranges into a DateTimeRanges object using the current culture.

public static DateTimeRanges Parse(string range)

Parameters

range string

The string representation of the ranges.

Returns

DateTimeRanges

A DateTimeRanges object containing the parsed ranges.

Parse(string, CultureInfo)

Parses a string representation of ranges into a DateTimeRanges object using a specified culture.

public static DateTimeRanges Parse(string range, CultureInfo cultureInfo)

Parameters

range string

The string representation of the ranges.

cultureInfo CultureInfo

The culture information to use for parsing.

Returns

DateTimeRanges

A DateTimeRanges object containing the parsed ranges.