LineClipping Struct

Describes the first and the last lines of a text, as the ComputeLineClipping methods find them, with the number of lines between them.

public readonly struct LineClipping : IEquatable<LineClipping>

Remarks

LineClipping.Head and LineClipping.Tail are ranges of the text that ComputeLineClipping was called on. Each range includes the line terminators of its lines, as they appear in the text.

The ComputeLineClipping methods ignore the blank lines at the start and at the end of the text. The documentation of this type does not count them among the lines of the text.

When LineClipping.OmittedLineCount is 0, the text is not clipped: LineClipping.Head covers every line of the text, and LineClipping.Tail is an empty range at the end of LineClipping.Head. LineClipping.OmittedLineCount is never 1, because no text is clipped by a single line.

The default value describes a text that has no lines.

See also

Implements

Properties

NameDescription
HeadGets the range of the first lines of the text.
HeadLineCountGets the number of lines in LineClipping.Head.
OmittedLineCountGets the number of lines of the text that are neither in LineClipping.Head nor in LineClipping.Tail.
TailGets the range of the last lines of the text.
TailLineCountGets the number of lines in LineClipping.Tail.

HeadLineCount

Gets the number of lines in LineClipping.Head.

public int HeadLineCount { get; }

Property value

int The headLines parameter of ComputeLineClipping when the text is clipped; otherwise, the number of lines of the text.

OmittedLineCount

Gets the number of lines of the text that are neither in LineClipping.Head nor in LineClipping.Tail.

public int OmittedLineCount { get; }

Property value

int The number of lines between the end of LineClipping.Head and the start of LineClipping.Tail, which is 0 when the text is not clipped, and at least 2 when it is.

Tail

Gets the range of the last lines of the text.

public Range Tail { get; }

Property value

Range A range that ends after the last line of the text and holds LineClipping.TailLineCount lines. Both of its indexes count from the start of the text.

TailLineCount

Gets the number of lines in LineClipping.Tail.

public int TailLineCount { get; }

Property value

int The tailLines parameter of ComputeLineClipping when the text is clipped; otherwise, 0.

Methods

NameDescription
Equals(LineClipping)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
GetHashCode()Returns the hash code for this instance.

Equals overloads

Equals(LineClipping)

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

public bool Equals(LineClipping other)
Parameters
other LineClipping
An object to compare with this object.
Returns

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

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

Operators

NameDescription
operator ==(LineClipping, LineClipping)Determines whether two specified LineClipping values are equal.
operator !=(LineClipping, LineClipping)Determines whether two specified LineClipping values are different.

operator ==(LineClipping, LineClipping)

Determines whether two specified LineClipping values are equal.

public static bool operator ==(LineClipping a, LineClipping b)

Parameters

a LineClipping
The first value to compare.
b LineClipping
The second value to compare.

Returns

bool true if a and b have the same ranges and the same line counts; otherwise, false.

operator !=(LineClipping, LineClipping)

Determines whether two specified LineClipping values are different.

public static bool operator !=(LineClipping a, LineClipping b)

Parameters

a LineClipping
The first value to compare.
b LineClipping
The second value to compare.

Returns

bool true if a and b differ in a range or in a line count; otherwise, false.