In This Article

CharInterval Struct

Stores an interval of characters.

public struct CharInterval : IEquatable<CharInterval>
Implements:
IEquatable<CharInterval>

Constructors

CharInterval(char)

Initializes an instance of the structure.

public CharInterval(char ch)
Parameter Type Description
ch char

The single character in the interval.

CharInterval(char, char)

Stores an interval of characters.

public CharInterval(char start, char end)
Parameter Type Description
start char

The start character in the interval.

end char

The end character in the interval.

Properties

Count

The number of characters contained in interval.

public readonly int Count { get; }

Property Value

int

End

The end character in the interval of this interval.

public readonly char End { get; }

Property Value

char

Start

The start character in the interval of this interval.

public readonly char Start { get; }

Property Value

char

Methods

Contains(CharInterval)

Returns whether the specified CharInterval is inclusively contained by this interval.

public readonly bool Contains(CharInterval interval)
Parameter Type Description
interval CharInterval

The CharInterval to test.

Returns

bool:

true if the specified CharInterval is inclusively contained by this interval; otherwise, false.

Contains(char)

Returns whether the specified character is contained by the interval.

public readonly bool Contains(char ch)
Parameter Type Description
ch char

The character to test.

Returns

bool:

true if the specified character is contained by the interval; otherwise, false.

Equals(CharInterval)

Indicates whether the current object is equal to another object of the same type.

public readonly bool Equals(CharInterval other)
Parameter Type Description
other CharInterval

An object to compare with this object.

Returns

bool:

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override readonly bool Equals(object? obj)
Parameter Type Description
obj object

The object to compare with the current object.

Returns

bool:

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override readonly int GetHashCode()

Returns

int:

A hash code for the current object.

GetIntersection(CharInterval)

Creates the intersection of the interval with another CharInterval.

public readonly CharInterval GetIntersection(CharInterval interval)
Parameter Type Description
interval CharInterval

The CharInterval used to find the intersection.

Returns

CharInterval

IntersectsWith(CharInterval)

Returns whether the specified CharInterval intersects with this interval.

public readonly bool IntersectsWith(CharInterval interval)
Parameter Type Description
interval CharInterval

The CharInterval to test.

Returns

bool:

true if the specified CharInterval intersects with this interval; otherwise, false.

ToString()

Returns the string representation of this object.

public override readonly string ToString()

Returns

string:

The string representation of this object.

Operators

operator ==(CharInterval, CharInterval)

Compares two color objects for equality.

public static bool operator ==(CharInterval left, CharInterval right)
Parameter Type Description
left CharInterval

A CharInterval to compare.

right CharInterval

A CharInterval to compare.

Returns

bool:

true if the color values of left and right are equal; otherwise, false.

operator !=(CharInterval, CharInterval)

Compares two color objects for inequality.

public static bool operator !=(CharInterval left, CharInterval right)
Parameter Type Description
left CharInterval

A CharInterval to compare.

right CharInterval

A CharInterval to compare.

Returns

bool:

true if the color values of left and right are unequal; otherwise, false.

Inherited Members

Extension Methods