Class SparseList<T>
A list which is optimised for the case where most of its elements share a common value.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Collections
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Serializable]
[DataContract]
public class SparseList<T> : ISparseList<T>, IList<T>, ICollection<T>, ISparseEnumerable<T>, IEnumerable<T>, IList, ICollection, IEnumerable, ICloneable
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
SparseList()
Null constructor.
Declaration
protected SparseList()
SparseList(ISparseList<T>)
Copy constructor.
Declaration
protected SparseList(ISparseList<T> that)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseList<T> | that | the sparse list to copy into this new sparse list |
SparseList(Int32)
Constructs a sparse list with the given number of elements.
Declaration
protected SparseList(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | Number of elements to allocate (>= 0). |
SparseList(Int32, T)
Constructs a sparse list of a given length and assigns all elements the given value.
Declaration
protected SparseList(int count, T commonValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | Number of elements to allocate (>= 0). |
| T | commonValue | The value to assign to all elements. |
SparseList(Int32, T, List<ValueAtIndex<T>>)
Constructs a sparse list of a given length and assigns all elements the given value, except for the specified list of sparse values. This list is stored internally as is so MUST be sorted by index and must not be modified externally after being passed in.
Declaration
protected SparseList(int count, T commonValue, List<ValueAtIndex<T>> sortedSparseValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | Number of elements to allocate (>= 0). |
| T | commonValue | The value to assign to all elements. |
| List<ValueAtIndex<T>> | sortedSparseValues | The list of sparse values, which must be sorted by index. |
Properties
CommonValue
The value of all elements not mentioned explicitly as sparse values.
Declaration
[DataMember]
public T CommonValue { get; protected set; }
Property Value
| Type | Description |
|---|---|
| T |
Count
Get or set the number of elements in this list. Set the number of elements will grow or shrink the list accordingly.
Declaration
public int Count { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
HasCommonElements
Returns true if there is at least one element which has the common value.
Declaration
public bool HasCommonElements { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsReadOnly
Sparse lists are not read only.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Item[Int32]
Gets or sets an element.
Declaration
public virtual T this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index |
Property Value
| Type | Description |
|---|---|
| T |
SparseCount
The number of elements not equal to the common value
Declaration
public int SparseCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
SparseValues
A list of the value and indices of elements which may not have the common value (although they are not precluded from doing so). This list is kept sorted by index to allow efficient operations on the sparse list.
Declaration
[DataMember]
public List<ValueAtIndex<T>> SparseValues { get; protected set; }
Property Value
| Type | Description |
|---|---|
| List<ValueAtIndex<T>> |
Sparsity
The Sparsity specification of this list.
Declaration
public Sparsity Sparsity { get; protected set; }
Property Value
| Type | Description |
|---|---|
| Sparsity |
Methods
Add(T)
Not implemented
Declaration
public void Add(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item |
All(Converter<T, Boolean>)
Tests if all elements in the list satisfy the specified condition.
Declaration
public bool All(Converter<T, bool> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| Converter<T, Boolean> | fun |
Returns
| Type | Description |
|---|---|
| Boolean |
Any(Converter<T, Boolean>)
Tests if any elements in the list satisfy the specified condition.
Declaration
public bool Any(Converter<T, bool> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| Converter<T, Boolean> | fun |
Returns
| Type | Description |
|---|---|
| Boolean |
CheckCompatible<T2>(IList<T2>, String)
Checks that a given list is the same size as this list. Throws an exception if not with the given string
Declaration
protected void CheckCompatible<T2>(IList<T2> that, string paramName)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<T2> | that | The list to check |
| String | paramName |
Type Parameters
| Name | Description |
|---|---|
| T2 |
Clear()
Clears this list, setting it to zero length.
Declaration
public void Clear()
Clone()
Clones this list - return as a sparse list.
Declaration
public SparseList<T> Clone()
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Constant(Int32, T)
Create a sparse list of given length with elements all equal to a specified value
Declaration
public static SparseList<T> Constant(int count, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | Number of elements in the list |
| T | value | Value for each element |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Contains(T)
Returns true if this list contains the specified value
Declaration
public bool Contains(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to test for |
Returns
| Type | Description |
|---|---|
| Boolean |
Copy(IList<T>)
Creator a sparse list as a copy of another list (which may not be sparse)
Declaration
public static SparseList<T> Copy(IList<T> that)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<T> | that | The source list - can be dense or sparse |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
CopyTo(T[], Int32)
Copies this sparse list to the given array starting at the specified index in the target array
Declaration
public void CopyTo(T[] array, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | The target array |
| Int32 | index | The start index in the target array |
Equals(Object)
Determines object equality.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | Another (list) object. |
Returns
| Type | Description |
|---|---|
| Boolean | True if equal. |
Overrides
EqualsAll(T)
Tests if all elements are equal to the given value.
Declaration
public bool EqualsAll(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to test against. |
Returns
| Type | Description |
|---|---|
| Boolean | True if all elements are equal to |
FromSize(Int32)
Create a sparse list of given length with elements all equal to the default value for the element type
Declaration
public static SparseList<T> FromSize(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | Number of elements in the list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
FromSparseValues(Int32, T, List<ValueAtIndex<T>>)
Constructs a sparse list from a sorted list of sparse elements.
Declaration
[Construction(new string[]{"Count", "CommonValue", "SparseValues"})]
public static SparseList<T> FromSparseValues(int count, T commonValue, List<ValueAtIndex<T>> sortedSparseValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | Count for result |
| T | commonValue | Common value |
| List<ValueAtIndex<T>> | sortedSparseValues | Sorted list of sparse elements |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
GetEnumerator()
Gets a typed enumerator which yields the list elements
Declaration
public IEnumerator<T> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<T> |
GetFirstCommonIndex()
Gets the dense index of the first common element.
Declaration
public int GetFirstCommonIndex()
Returns
| Type | Description |
|---|---|
| Int32 | Returns the dense index of the first common element or -1 if there are no common elements |
GetHashCode()
Gets a hash code for the instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | The code. |
Overrides
GetSparseEnumerator()
Gets a sparse enumerator
Declaration
public ISparseEnumerator<T> GetSparseEnumerator()
Returns
| Type | Description |
|---|---|
| ISparseEnumerator<T> |
GetSparseIndex(Int32)
Gets the index into the sparse values array corresponding to an element index. If there is no sparse value at that index, returns the binary complement of the index in the sparse array where such an element should be inserted to retain the sort order of the sparse array.
Declaration
protected int GetSparseIndex(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index |
Returns
| Type | Description |
|---|---|
| Int32 |
IndexOf(T)
Returns the index of the first occurence of the given value in the list. Returns -1 if the value is not in the list
Declaration
public int IndexOf(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The item to check for |
Returns
| Type | Description |
|---|---|
| Int32 | Its index in the list |
IndexOfAll(Converter<T, Boolean>)
Returns an enumeration of the indices of all elements which satisfy the specified condition. Indices are returned in sorted order.
Declaration
public IEnumerable<int> IndexOfAll(Converter<T, bool> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| Converter<T, Boolean> | fun |
Returns
| Type | Description |
|---|---|
| IEnumerable<Int32> |
Insert(Int32, T)
Not implemented
Declaration
public void Insert(int index, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | |
| T | item |
Reduce<TRes>(TRes, Func<TRes, T, TRes>)
Reduce method. Operates on this list
Declaration
public TRes Reduce<TRes>(TRes initial, Func<TRes, T, TRes> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| TRes | initial | Initial value |
| Func<TRes, T, TRes> | fun | Reduction function taking partial result and current element |
Returns
| Type | Description |
|---|---|
| TRes |
Type Parameters
| Name | Description |
|---|---|
| TRes |
Remarks
This method does not take advantage of this list's sparseness.
Reduce<TRes>(TRes, Func<TRes, T, TRes>, Func<TRes, T, Int32, TRes>)
Reduce method which can take advantage of sparse structure. Operates on this list
Declaration
public TRes Reduce<TRes>(TRes initial, Func<TRes, T, TRes> fun, Func<TRes, T, int, TRes> repeatedFun)
Parameters
| Type | Name | Description |
|---|---|---|
| TRes | initial | Initial value |
| Func<TRes, T, TRes> | fun | Reduction function taking partial result and current element |
| Func<TRes, T, Int32, TRes> | repeatedFun | Function which computes the reduction function applied multiple times |
Returns
| Type | Description |
|---|---|
| TRes |
Type Parameters
| Name | Description |
|---|---|
| TRes |
Remarks
This method does not take advantage of this list's sparseness.
Reduce<TRes, T1>(TRes, ISparseEnumerable<T1>, Func<TRes, T, T1, TRes>, Func<TRes, T, T1, Int32, TRes>)
Reduce method which can take advantage of sparse structure. Operates on this list and another sparse list
Declaration
public TRes Reduce<TRes, T1>(TRes initial, ISparseEnumerable<T1> that, Func<TRes, T, T1, TRes> fun, Func<TRes, T, T1, int, TRes> repeatedFun)
Parameters
| Type | Name | Description |
|---|---|---|
| TRes | initial | Initial value |
| ISparseEnumerable<T1> | that | The other sparse list |
| Func<TRes, T, T1, TRes> | fun | Reduction function taking partial result and current element |
| Func<TRes, T, T1, Int32, TRes> | repeatedFun | Function which computes the reduction function applied multiple times |
Returns
| Type | Description |
|---|---|
| TRes |
Type Parameters
| Name | Description |
|---|---|
| TRes | |
| T1 |
Reduce<TRes, T2>(TRes, IEnumerable<T2>, Func<TRes, T, T2, TRes>)
Reduce method. Operates on this list and another list.
Declaration
public TRes Reduce<TRes, T2>(TRes initial, IEnumerable<T2> that, Func<TRes, T, T2, TRes> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| TRes | initial | Initial value |
| IEnumerable<T2> | that | A second list |
| Func<TRes, T, T2, TRes> | fun | Reduction function taking partial result, current element, and current element of |
Returns
| Type | Description |
|---|---|
| TRes |
Type Parameters
| Name | Description |
|---|---|
| TRes | |
| T2 |
Remarks
This method does not take advantage of this list's sparseness.
Reduce<TRes, T1, T2>(TRes, ISparseEnumerable<T1>, ISparseEnumerable<T2>, Func<TRes, T, T1, T2, TRes>, Func<TRes, T, T1, T2, Int32, TRes>)
Reduce method which can take advantage of sparse structure. Operates on this list and two other sparse lists
Declaration
public TRes Reduce<TRes, T1, T2>(TRes initial, ISparseEnumerable<T1> b, ISparseEnumerable<T2> c, Func<TRes, T, T1, T2, TRes> fun, Func<TRes, T, T1, T2, int, TRes> repeatedFun)
Parameters
| Type | Name | Description |
|---|---|---|
| TRes | initial | Initial value |
| ISparseEnumerable<T1> | b | A second sparse list |
| ISparseEnumerable<T2> | c | A third sparse list |
| Func<TRes, T, T1, T2, TRes> | fun | Reduction function taking partial result and current element |
| Func<TRes, T, T1, T2, Int32, TRes> | repeatedFun | Function which computes the reduction function applied multiple times |
Returns
| Type | Description |
|---|---|
| TRes |
Type Parameters
| Name | Description |
|---|---|
| TRes | |
| T1 | |
| T2 |
Reduce<TRes, T1, T2>(TRes, IList<T1>, IList<T2>, Func<TRes, T, T1, T2, TRes>)
Reduce method. Operates on this list and two other lists.
Declaration
public TRes Reduce<TRes, T1, T2>(TRes initial, IList<T1> a, IList<T2> b, Func<TRes, T, T1, T2, TRes> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| TRes | initial | Initial value |
| IList<T1> | a | A second list |
| IList<T2> | b | A third list |
| Func<TRes, T, T1, T2, TRes> | fun | Reduction function taking partial result, current element, and current element of |
Returns
| Type | Description |
|---|---|
| TRes |
Type Parameters
| Name | Description |
|---|---|
| TRes | |
| T1 | |
| T2 |
Remarks
This method does not take advantage of this list's sparseness.
Remove(T)
Not implemented
Declaration
public bool Remove(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item |
Returns
| Type | Description |
|---|---|
| Boolean |
RemoveAt(Int32)
Not implemented
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index |
SetAllElementsTo(T)
Sets all elements to a given value.
Declaration
public void SetAllElementsTo(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The new value. |
SetTo(SparseList<T>)
Copies values from a sparse list to this sparse list.
Declaration
public void SetTo(SparseList<T> that)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseList<T> | that |
SetTo(IEnumerable<T>)
Declaration
public void SetTo(IEnumerable<T> that)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | that |
SetTo(IList<T>)
Copies values from another list.
Declaration
public void SetTo(IList<T> that)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<T> | that |
Remarks
The source list can be dense, in which case default(T) is used as the common value.
SetTo(IList<T>, T)
Copies values from a list which must have the same size as this list, using the specified common value.
Declaration
public virtual void SetTo(IList<T> dlist, T commonValue)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<T> | dlist | The list to copy from |
| T | commonValue | Common value |
SetToFunction<T2>(ISparseEnumerable<T2>, Func<T2, T>)
Sets the elements of this sparse list to a function of the elements of a sparse collection
Declaration
public SparseList<T> SetToFunction<T2>(ISparseEnumerable<T2> that, Func<T2, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseEnumerable<T2> | that | The other list |
| Func<T2, T> | fun | The function which maps from type T2 to type T |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T2 |
Remarks
Assumes the lists are the same length
SetToFunction<T2>(SparseList<T2>, Func<T2, T>)
Sets the elements of this sparse list to a function of the elements of another sparse list
Declaration
public SparseList<T> SetToFunction<T2>(SparseList<T2> that, Func<T2, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseList<T2> | that | The other list |
| Func<T2, T> | fun | The function which maps from type T2 to type T |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T2 |
Remarks
Assumes the lists are the same length
SetToFunction<T2>(IEnumerable<T2>, Func<T2, T>)
Sets the elements of this sparse list to a function of the elements of a collection
Declaration
public SparseList<T> SetToFunction<T2>(IEnumerable<T2> that, Func<T2, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T2> | that | The other list |
| Func<T2, T> | fun | The function which maps from type T2 to type T |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T2 |
Remarks
Assumes the lists are the same length
SetToFunction<T1, T2>(ISparseEnumerable<T1>, ISparseEnumerable<T2>, Func<T1, T2, T>)
Sets the elements of this sparse list to a function of the elements of two other sparse lists
Declaration
public SparseList<T> SetToFunction<T1, T2>(ISparseEnumerable<T1> a, ISparseEnumerable<T2> b, Func<T1, T2, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseEnumerable<T1> | a | The first list |
| ISparseEnumerable<T2> | b | The second list |
| Func<T1, T2, T> | fun | The function which maps two elements to an element of this list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 |
SetToFunction<T1, T2>(SparseList<T1>, SparseList<T2>, Func<T1, T2, T>)
Sets the elements of this sparse list to a function of the elements of two other sparse lists
Declaration
public SparseList<T> SetToFunction<T1, T2>(SparseList<T1> a, SparseList<T2> b, Func<T1, T2, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseList<T1> | a | The first list |
| SparseList<T2> | b | The second list |
| Func<T1, T2, T> | fun | The function which maps two elements to an element of this list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 |
Remarks
Assumes the lists are all the same length
SetToFunction<T1, T2>(IEnumerable<T1>, IEnumerable<T2>, Func<T1, T2, T>)
Sets the elements of this list to a function of the elements of two collections
Declaration
public SparseList<T> SetToFunction<T1, T2>(IEnumerable<T1> a, IEnumerable<T2> b, Func<T1, T2, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T1> | a | The first list |
| IEnumerable<T2> | b | The second list |
| Func<T1, T2, T> | fun | The function which maps the two elements of the other lists to an element of this list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 |
Remarks
Assumes the lists are the same length
SetToFunction<T1, T2, T3>(ISparseEnumerable<T1>, ISparseEnumerable<T2>, ISparseEnumerable<T3>, Func<T1, T2, T3, T>)
Sets the elements of this sparse list to a function of the elements of three sparse collections
Declaration
public SparseList<T> SetToFunction<T1, T2, T3>(ISparseEnumerable<T1> a, ISparseEnumerable<T2> b, ISparseEnumerable<T3> c, Func<T1, T2, T3, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseEnumerable<T1> | a | The first collection |
| ISparseEnumerable<T2> | b | The second collection |
| ISparseEnumerable<T3> | c | The third collection |
| Func<T1, T2, T3, T> | fun | The function which maps three elements to an element of this list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 | |
| T3 |
SetToFunction<T1, T2, T3>(IEnumerable<T1>, IEnumerable<T2>, IEnumerable<T3>, Func<T1, T2, T3, T>)
Sets the elements of this sparse list to a function of the elements of three sparse collections
Declaration
public SparseList<T> SetToFunction<T1, T2, T3>(IEnumerable<T1> a, IEnumerable<T2> b, IEnumerable<T3> c, Func<T1, T2, T3, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T1> | a | The first collection |
| IEnumerable<T2> | b | The second collection |
| IEnumerable<T3> | c | The third collection |
| Func<T1, T2, T3, T> | fun | The function which maps three elements to an element of this list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 | |
| T3 |
SetToFunction<T1, T2, T3, T4>(ISparseList<T1>, ISparseList<T2>, ISparseList<T3>, ISparseList<T4>, Func<T1, T2, T3, T4, T>)
Sets the elements of this sparse list to a function of the elements of three other collections
Declaration
public SparseList<T> SetToFunction<T1, T2, T3, T4>(ISparseList<T1> a, ISparseList<T2> b, ISparseList<T3> c, ISparseList<T4> d, Func<T1, T2, T3, T4, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseList<T1> | a | The first collection |
| ISparseList<T2> | b | The second collection |
| ISparseList<T3> | c | The third collection |
| ISparseList<T4> | d | The fourth collection |
| Func<T1, T2, T3, T4, T> | fun | The function which maps four elements to an element of this list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 | |
| T3 | |
| T4 |
SetToFunction<T1, T2, T3, T4>(IEnumerable<T1>, IEnumerable<T2>, IEnumerable<T3>, IEnumerable<T4>, Func<T1, T2, T3, T4, T>)
Sets the elements of this sparse list to a function of the elements of four sparse collections
Declaration
public SparseList<T> SetToFunction<T1, T2, T3, T4>(IEnumerable<T1> a, IEnumerable<T2> b, IEnumerable<T3> c, IEnumerable<T4> d, Func<T1, T2, T3, T4, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T1> | a | The first collection |
| IEnumerable<T2> | b | The second collection |
| IEnumerable<T3> | c | The third collection |
| IEnumerable<T4> | d | The fourth collection |
| Func<T1, T2, T3, T4, T> | fun | The function which maps four elements to an element of this list |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 | |
| T2 | |
| T3 | |
| T4 |
SetToFunctionInPlace<T1>(SparseList<T1>, Func<T, T1, T>)
Sets the elements of this sparse list to a function of the elements of this sparse list and another sparse list x = fun(x,b)
Declaration
public virtual SparseList<T> SetToFunctionInPlace<T1>(SparseList<T1> b, Func<T, T1, T> fun)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseList<T1> | b | The other sparse list |
| Func<T, T1, T> | fun | The function which maps (T,T1) to T |
Returns
| Type | Description |
|---|---|
| SparseList<T> |
Type Parameters
| Name | Description |
|---|---|
| T1 |
Remarks
Assumes the lists are the same length
ToArray()
Converts this sparse list to an array
Declaration
public T[] ToArray()
Returns
| Type | Description |
|---|---|
| T[] |
ToArray<T2>(IList<T2>)
Creates an array from the list
Declaration
protected T2[] ToArray<T2>(IList<T2> that)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<T2> | that |
Returns
| Type | Description |
|---|---|
| T2[] |
Type Parameters
| Name | Description |
|---|---|
| T2 |
ToList()
Converts this sparse list to an ordinary non-sparse list
Declaration
public List<T> ToList()
Returns
| Type | Description |
|---|---|
| List<T> |
ToString()
Converts this sparse list into a human readable string
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Overrides
ToString(String)
String representation of this list with a specified delimiter
Declaration
public string ToString(string delimiter)
Parameters
| Type | Name | Description |
|---|---|---|
| String | delimiter |
Returns
| Type | Description |
|---|---|
| String |
Explicit Interface Implementations
ICollection.CopyTo(Array, Int32)
Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | array | |
| Int32 | index |
ICollection.IsSynchronized
Declaration
bool ICollection.IsSynchronized { get; }
Returns
| Type | Description |
|---|---|
| Boolean |
ICollection.SyncRoot
Declaration
object ICollection.SyncRoot { get; }
Returns
| Type | Description |
|---|---|
| Object |
IEnumerable.GetEnumerator()
Gets an enumerator which yields the list elements
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator |
IList.Add(Object)
Not implemented
Declaration
int IList.Add(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value |
Returns
| Type | Description |
|---|---|
| Int32 |
IList.Contains(Object)
Declaration
bool IList.Contains(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value |
Returns
| Type | Description |
|---|---|
| Boolean |
IList.IndexOf(Object)
Declaration
int IList.IndexOf(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value |
Returns
| Type | Description |
|---|---|
| Int32 |
IList.Insert(Int32, Object)
Not implemented
Declaration
void IList.Insert(int index, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | |
| Object | value |
IList.IsFixedSize
Declaration
bool IList.IsFixedSize { get; }
Returns
| Type | Description |
|---|---|
| Boolean |
IList.Item[Int32]
Declaration
object IList.this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index |
Returns
| Type | Description |
|---|---|
| Object |
IList.Remove(Object)
Not implemented
Declaration
void IList.Remove(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value |
ICloneable.Clone()
Clones this list - return as an object
Declaration
object ICloneable.Clone()
Returns
| Type | Description |
|---|---|
| Object |