Class SortedSet<T>
Represents a strongly typed list of objects that will be sorted using the IComparable interface.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public class SortedSet<T> : ISet<T>, ICollection<T>, IEnumerable<T>, ICollection, IEnumerable
Type Parameters
T
The type of the elements in the list. |
Remarks
Re-implemented for compatibility with Windows Phone/Silverlight.
Constructors
SortedSet()
Creates a new sorted set.
Declaration
public SortedSet()
SortedSet(IComparer<T>)
Creates a new sorted set.
Declaration
public SortedSet(IComparer<T> comparer)
Parameters
IComparer<T>
comparer
|
SortedSet(IEnumerable<T>)
Creates a new sorted set.
Declaration
public SortedSet(IEnumerable<T> enumerable)
Parameters
IEnumerable<T>
enumerable
|
SortedSet(IEnumerable<T>, IComparer<T>)
Creates a new sorted set.
Declaration
public SortedSet(IEnumerable<T> enumerable, IComparer<T> comparer)
Parameters
IEnumerable<T>
enumerable
|
IComparer<T>
comparer
|
Properties
Comparer
Gets the System.Collections.Generic.IEqualityComparer object that is used to determine equality for the values in the System.Collections.Generic.SortedSet.
Declaration
public IComparer<T> Comparer { get; }
Property Value
IComparer<T>
|
Count
Gets the number of elements contained in the SortedSet<T>.
Declaration
public int Count { get; }
Property Value
System.Int32
|
IsReadOnly
Gets a value indicating whether the SortedSet is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
System.Boolean
|
IsSynchronized
Gets a value indicating whether access to the System.Collections.ICollection is synchronized (thread safe).
Declaration
public bool IsSynchronized { get; }
Property Value
System.Boolean
|
Max
Gets the maximum value in the System.Collections.Generic.SortedSet, as defined by the comparer.
Declaration
public T Max { get; }
Property Value
T
|
Min
Gets the minimum value in the System.Collections.Generic.SortedSet, as defined by the comparer.
Declaration
public T Min { get; }
Property Value
T
|
SyncRoot
Gets an object that can be used to synchronize access to the System.Collections.ICollection.
Declaration
public object SyncRoot { get; }
Property Value
System.Object
|
Methods
Add(T)
Adds an item to the SortedSet<T>.
Declaration
public bool Add(T item)
Parameters
T
item
|
Returns
System.Boolean
|
Clear()
Contains(T)
Determines whether the SortedSet<T> contains a specific value.
Declaration
public bool Contains(T item)
Parameters
T
item
The object to locate in the SortedSet<T>. |
Returns
System.Boolean
true if item is found in the SortedSet<T>; otherwise, false. |
CopyTo(T[], Int32)
Copies the elements of the SortedSet<T> to an System.Array, starting at a particular System.Array index.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
T[]
array
The one-dimensional System.Array that is the destination of the elements copied from SortedSet<T>. The System.Array must have zero-based indexing. |
System.Int32
arrayIndex
The zero-based index in array at which copying begins. |
CopyTo(Array, Int32)
Copies all objects to the given array starting at the given location.
Declaration
public void CopyTo(Array array, int index)
Parameters
Array
array
|
System.Int32
index
|
ExceptWith(IEnumerable<T>)
Removes all elements in the specified collection.
Declaration
public void ExceptWith(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
IEnumerator<T>
A System.Collections.Generic.IEnumerator that can be used to iterate through the collection. |
IntersectWith(IEnumerable<T>)
Keeps only the elements that are in the given collection and in this set.
Declaration
public void IntersectWith(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
IsProperSubsetOf(IEnumerable<T>)
Returns true if all elements in the given collection are contained in this set.
Declaration
public bool IsProperSubsetOf(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
Returns
System.Boolean
|
IsProperSupersetOf(IEnumerable<T>)
Returns true if all elements in this set are also in the given collection.
Declaration
public bool IsProperSupersetOf(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
Returns
System.Boolean
|
IsSubsetOf(IEnumerable<T>)
Declaration
public bool IsSubsetOf(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
Returns
System.Boolean
|
IsSupersetOf(IEnumerable<T>)
Declaration
public bool IsSupersetOf(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
Returns
System.Boolean
|
Overlaps(IEnumerable<T>)
Returns true if this collection and the other share at least one element.
Declaration
public bool Overlaps(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
Returns
System.Boolean
|
Remove(T)
Removes the first occurrence of a specific object from the SortedSet<T>.
Declaration
public bool Remove(T item)
Parameters
T
item
The object to remove from the SortedSet<T>. |
Returns
System.Boolean
true if item was successfully removed from the SortedSet<T>; otherwise, false. This method also returns false if item is not found in the original SortedSet<T>. |
SetEquals(IEnumerable<T>)
Returns true if the two sets contain the same elements.
Declaration
public bool SetEquals(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
Returns
System.Boolean
|
SymmetricExceptWith(IEnumerable<T>)
Keeps only items that are in one set or the other but not in both.
Declaration
public void SymmetricExceptWith(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
UnionWith(IEnumerable<T>)
Adds all items in other too.
Declaration
public void UnionWith(IEnumerable<T> other)
Parameters
IEnumerable<T>
other
|
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
System.Collections.IEnumerator
An System.Collections.IEnumerator object that can be used to iterate through the collection. |