Class EquatableList<T>
Represents a strongly typed list of objects that can be accessed by index. Provides methods to manipulate lists. Also provides functionality to compare lists against each other through an implementations of System.IEquatable<T>, or to wrap an existing list to use the same comparison logic as this one while not affecting any of its other functionality.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Support
Assembly: Lucene.Net.dll
Syntax
public class EquatableList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IEquatable<IList<T>>
  Type Parameters
| Name | Description | 
|---|---|
| T | The type of elements in the list.  | 
      
Constructors
| Improve this Doc View SourceEquatableList()
Initializes a new instance of the EquatableList<T> class that is empty and has the default initial capacity.
Declaration
public EquatableList()
  EquatableList(IEnumerable<T>)
Initializes a new instance of the EquatableList<T> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.
Declaration
public EquatableList(IEnumerable<T> collection)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<T> | collection | The collection whose elements are copied to the new list.  | 
      
EquatableList(IList<T>, Boolean)
Initializes a new instance of EquatableList<T>.
If the wrap parameter is true, the
collection is used as is without doing
a copy operation. Otherwise, the collection is copied 
(which is the same operation as the 
EquatableList(IEnumerable<T>) overload). 
The internal collection is used for
all operations except for Equals(Object), GetHashCode(),
and ToString(), which are all based on deep analysis
of this collection and any nested collections.
Declaration
public EquatableList(IList<T> collection, bool wrap)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IList<T> | collection | The collection that will either be wrapped or copied 
depending on the value of   | 
      
| System.Boolean | wrap | 
  | 
      
EquatableList(Int32)
Initializes a new instance of the EquatableList<T> class that is empty and has the specified initial capacity.
Declaration
public EquatableList(int capacity)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | capacity | The number of elements that the new list can initially store.  | 
      
Properties
| Improve this Doc View SourceCount
Gets the number of elements contained in the EquatableList<T>.
Declaration
public virtual int Count { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
IsReadOnly
Gets a value indicating whether the EquatableList<T> is read-only.
Declaration
public virtual bool IsReadOnly { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Item[Int32]
Gets or sets the element at the specified index.
Declaration
public virtual T this[int index] { get; set; }
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | The zero-based index of the element to get or set.  | 
      
Property Value
| Type | Description | 
|---|---|
| T | 
Methods
| Improve this Doc View SourceAdd(T)
Adds an object to the end of the EquatableList<T>.
Declaration
public virtual void Add(T item)
  Parameters
| Type | Name | Description | 
|---|---|---|
| T | item | The object to be added to the end of the EquatableList<T>. The value can be   | 
      
Clear()
Removes all items from the EquatableList<T>.
Declaration
public virtual void Clear()
  Clone()
Clones the EquatableList<T>.
Declaration
public virtual object Clone()
  Returns
| Type | Description | 
|---|---|
| System.Object | A new shallow clone of this EquatableList<T>.  | 
      
Remarks
This is a shallow clone.
Contains(T)
Determines whether the EquatableList<T> contains a specific value.
Declaration
public virtual bool Contains(T item)
  Parameters
| Type | Name | Description | 
|---|---|---|
| T | item | The object to locate in the EquatableList<T>.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
CopyTo(T[], Int32)
Copies the entire EquatableList<T> to a compatible one-dimensional array, starting at the specified index of the target array.
Declaration
public virtual void CopyTo(T[] array, int arrayIndex)
  Parameters
| Type | Name | Description | 
|---|---|---|
| T[] | array | The one-dimensional System.Array that is the destination of the elements copied from EquatableList<T>. The Array must have zero-based indexing.  | 
      
| System.Int32 | arrayIndex | The zero-based index in   | 
      
Equals(IList<T>)
Compares this sequence to another System.Collections.Generic.IList<T>
implementation, returning true if they are equal, false otherwise.
The comparison takes into consideration any values in this collection and values of any nested collections, but does not take into consideration the data type. Therefore, EquatableList<T> can equal any System.Collections.Generic.IList<T> with the exact same values in the same order.
Declaration
public virtual bool Equals(IList<T> other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IList<T> | other | The other System.Collections.Generic.IList<T> implementation to compare against.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
Equals(Object)
If the object passed implements System.Collections.Generic.IList<T>,
compares this sequence to other, returning true if they 
are equal, false otherwise.
The comparison takes into consideration any values in this collection and values of any nested collections, but does not take into consideration the data type. Therefore, EquatableList<T> can equal any System.Collections.Generic.IList<T> with the exact same values in the same order.
Declaration
public override bool Equals(object other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | other | The other object to compare against.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
Overrides
GetEnumerator()
Returns an enumerator that iterates through the EquatableList<T>.
Declaration
public virtual IEnumerator<T> GetEnumerator()
  Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerator<T> | An System.Collections.Generic.IEnumerator<T> for the EquatableList<T>.  | 
      
GetHashCode()
Returns the hash code value for this list.
The hash code determination takes into consideration any values in this collection and values of any nested collections, but does not take into consideration the data type. Therefore, the hash codes will be exactly the same for this EquatableList<T> and another System.Collections.Generic.IList<T> (including arrays) with the same values in the same order.
Declaration
public override int GetHashCode()
  Returns
| Type | Description | 
|---|---|
| System.Int32 | the hash code value for this list  | 
      
Overrides
IndexOf(T)
Determines the index of a specific item in the EquatableList<T>.
Declaration
public virtual int IndexOf(T item)
  Parameters
| Type | Name | Description | 
|---|---|---|
| T | item | The object to locate in the EquatableList<T>.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Int32 | The index of   | 
      
Insert(Int32, T)
Inserts an item to the EquatableList<T> at the specified index.
Declaration
public virtual void Insert(int index, T item)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | The zero-based index at which   | 
      
| T | item | The object to insert into the EquatableList<T>.  | 
      
Remove(T)
Removes the first occurrence of a specific object from the EquatableList<T>.
Declaration
public virtual bool Remove(T item)
  Parameters
| Type | Name | Description | 
|---|---|---|
| T | item | The object to remove from the EquatableList<T>.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
RemoveAt(Int32)
Removes the EquatableList<T> item at the specified index.
Declaration
public virtual void RemoveAt(int index)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | The zero-based index of the item to remove.  | 
      
ToString()
Returns a string representation of this collection (and any nested collections). The string representation consists of a list of the collection's elements in the order they are returned by its enumerator, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
Declaration
public override string ToString()
  Returns
| Type | Description | 
|---|---|
| System.String | a string representation of this collection  | 
      
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Returns an enumerator that iterates through the EquatableList<T>.
Declaration
IEnumerator IEnumerable.GetEnumerator()
  Returns
| Type | Description | 
|---|---|
| System.Collections.IEnumerator | An System.Collections.IEnumerator for the EquatableList<T>.  |