Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Collections.​Hashtable

Assembly: System.Runtime

Inheritance: object → Hashtable

Represents a collection of key/value pairs that are organized based on the hash code of the key.

Properties

protected IComparer
comparer
Gets or sets the <see cref="T:System.Collections.IComparer" /> to use for the <see cref="T:System.Collections.Hashtable" /> .
public int
Count
Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Hashtable" /> .
protected IEqualityComparer
EqualityComparer
Gets the <see cref="T:System.Collections.IEqualityComparer" /> to use for the <see cref="T:System.Collections.Hashtable" /> .
protected IHashCodeProvider
hcp
Gets or sets the object that can dispense hash codes.
public bool
IsFixedSize
Gets a value indicating whether the <see cref="T:System.Collections.Hashtable" /> has a fixed size.
public bool
IsReadOnly
Gets a value indicating whether the <see cref="T:System.Collections.Hashtable" /> is read-only.
public bool
IsSynchronized
Gets a value indicating whether access to the <see cref="T:System.Collections.Hashtable" /> is synchronized (thread safe).
public object
Item
public ICollection
Keys
Gets an <see cref="T:System.Collections.ICollection" /> containing the keys in the <see cref="T:System.Collections.Hashtable" /> .
public object
SyncRoot
Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.Hashtable" /> .
public ICollection
Values
Gets an <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.Hashtable" /> .

Methods

public void
Add​(object key, object value)
key The key of the element to add.
value The value of the element to add. The value can be <see langword="null" /> .
Adds an element with the specified key and value into the <see cref="T:System.Collections.Hashtable" /> .
public void
Clear​()
Removes all elements from the <see cref="T:System.Collections.Hashtable" /> .
public object
Clone​()
Returns A shallow copy of the <see cref="T:System.Collections.Hashtable" /> .
Creates a shallow copy of the <see cref="T:System.Collections.Hashtable" /> .
public bool
Contains​(object key)
key The key to locate in the <see cref="T:System.Collections.Hashtable" /> .
Returns <see langword="true" /> if the <see cref="T:System.Collections.Hashtable" /> contains an element with the specified key; otherwise, <see langword="false" /> .
Determines whether the <see cref="T:System.Collections.Hashtable" /> contains a specific key.
public bool
ContainsKey​(object key)
key The key to locate in the <see cref="T:System.Collections.Hashtable" /> .
Returns <see langword="true" /> if the <see cref="T:System.Collections.Hashtable" /> contains an element with the specified key; otherwise, <see langword="false" /> .
Determines whether the <see cref="T:System.Collections.Hashtable" /> contains a specific key.
public bool
ContainsValue​(object value)
value The value to locate in the <see cref="T:System.Collections.Hashtable" /> . The value can be <see langword="null" /> .
Returns <see langword="true" /> if the <see cref="T:System.Collections.Hashtable" /> contains an element with the specified <paramref name="value" /> ; otherwise, <see langword="false" /> .
Determines whether the <see cref="T:System.Collections.Hashtable" /> contains a specific value.
public void
CopyTo​(Array array, int arrayIndex)
array The one-dimensional <see cref="T:System.Array" /> that is the destination of the <see cref="T:System.Collections.DictionaryEntry" /> objects copied from <see cref="T:System.Collections.Hashtable" /> . The <see cref="T:System.Array" /> must have zero-based indexing.
arrayIndex The zero-based index in <paramref name="array" /> at which copying begins.
Copies the <see cref="T:System.Collections.Hashtable" /> elements to a one-dimensional <see cref="T:System.Array" /> instance at the specified index.
GetEnumerator​()
Returns An <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.Hashtable" /> .
Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> that iterates through the <see cref="T:System.Collections.Hashtable" /> .
protected int
GetHash​(object key)
key The <see cref="T:System.Object" /> for which a hash code is to be returned.
Returns The hash code for <paramref name="key" /> .
Returns the hash code for the specified key.
public void
GetObjectData​(Runtime.Serialization.SerializationInfo info, Runtime.Serialization.StreamingContext context)
info A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object containing the information required to serialize the <see cref="T:System.Collections.Hashtable" /> .
context A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object containing the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Hashtable" /> .
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and returns the data needed to serialize the <see cref="T:System.Collections.Hashtable" /> .
protected bool
KeyEquals​(object item, object key)
item The <see cref="T:System.Object" /> to compare with <paramref name="key" /> .
key The key in the <see cref="T:System.Collections.Hashtable" /> to compare with <paramref name="item" /> .
Returns <see langword="true" /> if <paramref name="item" /> and <paramref name="key" /> are equal; otherwise, <see langword="false" /> .
Compares a specific <see cref="T:System.Object" /> with a specific key in the <see cref="T:System.Collections.Hashtable" /> .
public void
OnDeserialization​(object sender)
sender The source of the deserialization event.
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and raises the deserialization event when the deserialization is complete.
public void
Remove​(object key)
key The key of the element to remove.
Removes the element with the specified key from the <see cref="T:System.Collections.Hashtable" /> .
public bool
Equals​(object obj)
Inherited from object
obj The object to compare with the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public int
GetHashCode​()
Inherited from object
Returns A hash code for the current object.
Serves as the default hash function.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.