Class TypedSortedListEx<TKey, TValue>
Implements
Namespace: Syncfusion.XlsIO.Implementation
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public class TypedSortedListEx<TKey, TValue> : Object, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IDictionary, ICollection where TKey : IComparable
Type Parameters
Name |
---|
TKey |
TValue |
Constructors
TypedSortedListEx()
Default constructor.
Declaration
public TypedSortedListEx()
TypedSortedListEx(IComparer<TKey>)
Creates an empty SortedList with the default initial capacity and specified comparer.
Declaration
public TypedSortedListEx(IComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IComparer<TKey> | comparer | The IComparer is used to determine whether two keys are equal. |
TypedSortedListEx(IComparer<TKey>, Int32)
Creates an empty SortedList with the specified initial capacity and specified comparer.
Declaration
public TypedSortedListEx(IComparer<TKey> comparer, int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IComparer<TKey> | comparer | Initial capacity. |
System.Int32 | capacity | The IComparer is used to determine whether two keys are equal. |
TypedSortedListEx(IDictionary<TKey, TValue>)
Copies the elements from the specified dictionary to a new list with the same initial capacity as the number of elements copied.
Declaration
public TypedSortedListEx(IDictionary<TKey, TValue> d)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue> | d | The IDictionary to copy. |
TypedSortedListEx(IDictionary<TKey, TValue>, IComparer<TKey>)
Copies the elements from the specified dictionary to a new list with the same initial capacity as the number of elements copied and with the specified comparer.
Declaration
public TypedSortedListEx(IDictionary<TKey, TValue> d, IComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue> | d | The IDictionary to copy. |
System.Collections.Generic.IComparer<TKey> | comparer | The IComparer to use to determine whether two keys are equal. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | When argument d is null. |
TypedSortedListEx(Int32)
Creates an empty list with the specified initial capacity.
Declaration
public TypedSortedListEx(int initialCapacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | initialCapacity | Initial capacity. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When initialCapacity is less than zero. |
Properties
Capacity
Capacity of internal buffers.
Declaration
public virtual int Capacity { get; set; }
Property Value
Type |
---|
System.Int32 |
Count
Size of the collection. Read-only.
Declaration
public virtual int Count { get; }
Property Value
Type |
---|
System.Int32 |
IsFixedSize
Returns True if collection has fixed size, False otherwise.
Declaration
public virtual bool IsFixedSize { get; }
Property Value
Type |
---|
System.Boolean |
IsReadOnly
Returns True if list is readonly, False otherwise. Read-only.
Declaration
public virtual bool IsReadOnly { get; }
Property Value
Type |
---|
System.Boolean |
IsSynchronized
Returns True if the collection is synchronized, False otherwise.
Declaration
public virtual bool IsSynchronized { get; }
Property Value
Type |
---|
System.Boolean |
Item[TKey]
Gets or sets the value associated with the specified key.
Declaration
public virtual TValue this[TKey key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key |
Property Value
Type |
---|
TValue |
Item[Object]
Declaration
public object this[object key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
Property Value
Type |
---|
System.Object |
Keys
List of keys. Read-only.
Declaration
public virtual IList<TKey> Keys { get; }
Property Value
Type |
---|
System.Collections.Generic.IList<TKey> |
SyncRoot
Returns the object that can be used to synchronize access to the collection. Read-only.
Declaration
public virtual object SyncRoot { get; }
Property Value
Type |
---|
System.Object |
Values
List of values. Read-only.
Declaration
public virtual IList<TValue> Values { get; }
Property Value
Type |
---|
System.Collections.Generic.IList<TValue> |
Methods
Add(TKey, TValue)
Adds an element with the provided key and value to the list.
Declaration
public virtual void Add(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The Object to use as the key of the element to add. |
TValue | value | The Object to use as the value of the element to add. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | When key is null. |
System.ArgumentException | When list already contains specified key. |
Add(KeyValuePair<TKey, TValue>)
Adds item
Declaration
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Add(Object, Object)
Adds item
Declaration
public void Add(object key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | |
System.Object | value |
Clear()
Removes all elements from the collection.
Declaration
public virtual void Clear()
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
System.Object | Copy of the current instance. |
CloneAll()
Clone current instance.
Declaration
public TypedSortedListEx<TKey, TValue> CloneAll()
Returns
Type | Description |
---|---|
TypedSortedListEx<TKey, TValue> | Returns clone of current object. |
Contains(TKey)
Determines whether the list contains an element with the specified key.
Declaration
public virtual bool Contains(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key of the element to search. |
Returns
Type | Description |
---|---|
System.Boolean | True if list contains specified key. |
Contains(KeyValuePair<TKey, TValue>)
Checks if the item exists
Declaration
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Returns
Type |
---|
System.Boolean |
Contains(Object)
Checks if the dictonary contains the key
Declaration
public bool Contains(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
Returns
Type |
---|
System.Boolean |
ContainsKey(TKey)
Determines whether the list contains an element with the specified key.
Declaration
public virtual bool ContainsKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key of the element to search. |
Returns
Type | Description |
---|---|
System.Boolean | True if list contains specified key. |
ContainsValue(TValue)
Determines whether the list contains the specified value.
Declaration
public virtual bool ContainsValue(TValue value)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | Value of the element to search. |
Returns
Type | Description |
---|---|
System.Boolean | True if list contains specified value. |
GetByIndex(Int32)
Gets the value at the specified index of the SortedListEx.
Declaration
public virtual TValue GetByIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the value to get. |
Returns
Type | Description |
---|---|
TValue | The value at the specified index of the SortedListEx. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When index is less than zero or greater than size of the list. |
GetByName(String)
Gets the value at the specified name of the SortedListEx.
Declaration
public virtual TValue GetByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
TValue | The value at the specified index of the SortedListEx. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | When string is null. |
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type |
---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> |
GetKey(Int32)
Gets the key at the specified index of the SortedListEx.
Declaration
public virtual TKey GetKey(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the key to get. |
Returns
Type | Description |
---|---|
TKey | The key at the specified index of the SortedListEx. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When index is less than zero or greater than size of the list. |
GetKeyList()
Gets the keys in the SortedListEx.
Declaration
public virtual IList<TKey> GetKeyList()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<TKey> | An IList containing the keys in the SortedListEx. |
GetValueList()
Gets the values in the SortedListEx.
Declaration
public virtual IList<TValue> GetValueList()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<TValue> | An IList containing the values in the SortedListEx. |
IndexOfKey(TKey)
Returns the zero-based index of the specified key.
Declaration
public virtual int IndexOfKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to locate. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of key, if key is found; otherwise, -1. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If specified key is null. |
IndexOfValue(TValue)
Returns the zero-based index of the first occurrence of the specified value.
Declaration
public virtual int IndexOfValue(TValue value)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value to locate (can be NULL). |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first occurrence of value, if value is found; otherwise, -1. |
Remove(TKey)
Removes the element with the specified key from SortedListEx.
Declaration
public virtual bool Remove(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the element to remove. |
Returns
Type |
---|
System.Boolean |
Remove(KeyValuePair<TKey, TValue>)
Removes the item
Declaration
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Returns
Type |
---|
System.Boolean |
Remove(Object)
Removes key from dictonary
Declaration
public void Remove(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
RemoveAt(Int32)
Removes the element at the specified index.
Declaration
public virtual void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to remove. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When index is less than zero or greater than size of the list. |
SetByIndex(Int32, TValue)
Replaces the value at the specific index.
Declaration
public virtual void SetByIndex(int index, TValue value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which to save value. |
TValue | value | The Object to save into. Can be NULL. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When index is less than zero or greater than size of the list. |
Synchronized(TypedSortedListEx<TKey, TValue>)
Returns a synchronized (thread-safe) wrapper for the SortedList.
Declaration
public static TypedSortedListEx<TKey, TValue> Synchronized(TypedSortedListEx<TKey, TValue> list)
Parameters
Type | Name | Description |
---|---|---|
TypedSortedListEx<TKey, TValue> | list | The SortedList to synchronize. |
Returns
Type | Description |
---|---|
TypedSortedListEx<TKey, TValue> | A synchronized (thread-safe) wrapper for the SortedList. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | When list is null. |
TrimToSize()
Sets the capacity to the actual number of elements.
Declaration
public virtual void TrimToSize()
TryGetValue(TKey, out TValue)
TryGetValue from dictonary
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | |
TValue | value |
Returns
Type |
---|
System.Boolean |