Diff : Algorithm.Diff Namespace
Range

A window into another list.

[System.Reflection.DefaultMember(MemberName="Item")]
public class Range : IList


Remarks

The Range object provides a window into a IList object, and exposes the window as a ICollection.

The elements in this range can be accessed either with the indexer or via a for-each over the Range.

Members

See Also: Inherited members from object.

Constructors
Constructs a new range for the given list, with the window starting at the given index and with the given length.
Properties
Count [read-only]
int . The length of the range.
End [read-only]
int . The ending index of this range in the original list.
Item [int] [read-only]
object . Returns an item from the original list exposed by this range.
Start [read-only]
int . The starting index of this range in the original list.
Methods
Contains (object) : bool
Returns whether the range contains the given item.
IndexOf (object) : int
Returns the index of the object in the range.
Member Details
Range Constructor
public Range (IList list, int start, int count)

Constructs a new range for the given list, with the window starting at the given index and with the given length.

Parameters
list
The list to wrap.
start
The starting index in the list to wrap.
count
The size of the window.
Remarks
None.

Start
public int Start { get; }

The starting index of this range in the original list.

Value
The starting index of this range in the original list.
Remarks
None.

Count
public int Count { get; }

The length of the range.

Value
The length of the range (i.e. the size of the window).
Remarks
None.

End
public int End { get; }

The ending index of this range in the original list.

Value
The ending index of this range in the original list.
Remarks
None.

Item
public object Item [int index] { get; }

Returns an item from the original list exposed by this range.

Parameters
index
The index of the item, from 0 to Algorithm.Diff.Range.Count-1.
Value
An element of the original list.
Remarks
This property returns the element at the index + index in the original list.

Contains
public bool Contains (object obj)

Returns whether the range contains the given item.

Parameters
obj
The item to see if the range contains it.
Returns
True if the object equals (via System.Object.Equals) some object in the range, otherwise false.
Remarks
The test is performed as a linear search.

IndexOf
public int IndexOf (object obj)

Returns the index of the object in the range.

Parameters
obj
The object to get the index of.
Returns
The first index of an object that equals (via System.Object.Equals) obj, or -1 if no equal object is found.
Remarks
The search is done linearly.