SortedSet Methods in C#
Methods
- Add :- public bool Add (T item);
- Contains :- public bool Contains (T item);returns true if element present in the set otherwise false
Time Complexity :- O(log n)
- Clear :- public void Clear ();It will remove all elements from the set.
Time Complexity :- O(n)
- CopyTo(T[]) :- public void CopyTo (T[] array);
Copy all source set elements into provided 1-D array
- CopyTo (T[] , int) :- public void CopyTo (T[] array, int arrayIndex);
Copy source set elements into provided 1-D array from index, arrayIndex passed by params (zero-based index)
- CopyTo (T[] , int , int) :- public void CopyTo (T[] array, int arrayIndex, int count);
Copy specific number (passed in params) of source set elements into provided 1-D array from index, arrayIndex passed by params (zero-based index)
- CreateSetComparer() :- public static System.Collections.Generic.IEqualityComparer<System.Collections.Generic.SortedSet<T>> CreateSetComparer ();
- CreateSetComparer(IEqualityComparer<T>) :-
public static System.Collections.Generic.IEqualityComparer<System.Collections.Generic.SortedSet<T>> CreateSetComparer (System.Collections.Generic.IEqualityComparer<T>? memberEqualityComparer);
- Equals (Object) :- public virtual bool Equals (object? obj);
- ExceptWith(IEnumerable<T>) :- public void ExceptWith (System.Collections.Generic.IEnumerable<T> other);
Remove all elements form the source set SortedSet<T> that are present in specified collection IEnumerable<T>.
- GetEnumerator() :- public System.Collections.Generic.SortedSet<T>.Enumerator GetEnumerator ();
Proides an enumerator that iterates through the SortedSet<T>.
- GetHashCode() :- public virtual int GetHashCode ();
Returns a hashcode of current object.
- GetType() :- public Type GetType ();
Returns the type of current instance.
- IntersectWith(IEnumerable<T>) :- public void IntersectWith (System.Collections.Generic.IEnumerable<T> other);
i will modify current SortedSet such a way so that it will contains only elements that are present in set and provided collection both.
- IsProperSubsetOf(IEnumerable<T>) :- public bool IsProperSubsetOf (System.Collections.Generic.IEnumerable<T> other);
- IsProperSupersetOf(IEnumerable<T>) :- public bool IsProperSupersetOf (System.Collections.Generic.IEnumerable<T> other);
- IsSubsetOf(IEnumerable<T>) :- public bool IsSubsetOf (System.Collections.Generic.IEnumerable<T> other);
- IsSupersetOf(IEnumerable<T>) :- public bool IsSupersetOf (System.Collections.Generic.IEnumerable<T> other);
- MemberwiseClone() :- protected object MemberwiseClone ();
it will creates and return a shallow copy of the current Object.
- OnDeserialization(Object) :-protected virtual void OnDeserialization (object? sender);
- Overlaps(IEnumerable<T>) :- public bool Overlaps (System.Collections.Generic.IEnumerable<T> other);
Returns true if the SortedSet<T> object and other provided collection object IEnumerable<T> share at least one common element otherwise false
- Remove(T) :- public bool Remove (T item);
Remove the specified elements (pass in params) from the SortedSet.
- RemoveWhere(Predicate<T>) :- public int RemoveWhere (Predicate<T> match);
Removes all elements from the current SortedSet<T> that satisfy the conditions defined by the given predicate and return the total number of elements removed from the SortedSet<T>.
- SetEquals(IEnumerable<T>) :- public bool SetEquals (System.Collections.Generic.IEnumerable<T> other);
Returns true if current SortedSet<T> and given collection IEnumerable<T> contains the same elements otherwise false.
- SymmetricExceptWith(IEnumerable<T>) :- public void SymmetricExceptWith (System.Collections.Generic.IEnumerable<T> other);
it will modifies the current SortedSet<T> object so that it contains only elements that are present either in the current object or in the specified collection, but not both.
- ToString() :- public virtual string? ToString ();
It will return a string that represents the current object.
- TryGetValue(T, T)public bool TryGetValue (T equalValue, out T actualValue);
- UnionWith(IEnumerable<T>) :- public void UnionWith (System.Collections.Generic.IEnumerable<T> other);
it will modify current SortedSet<T> object so that it contains all elements that are present either in the current SortedSet<T> object or in the specified collection IEnumerable<T>.
- Reverse() :- public System.Collections.Generic.IEnumerable<T> Reverse ();
It will return an enumerator that iterates over the SortedSet<T> in reverse order.
- GetViewBetween(T, T) :- public virtual System.Collections.Generic.SortedSet<T> GetViewBetween (T? lowerValue, T? upperValue);
It will return a subset view that contains only the values between lowerValue and upperValue range.
- GetObjectData(SerializationInfo, StreamingContext) :-
protected virtual void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);