PropertyCollection PropertyCollection PropertyCollection PropertyCollection Class

Definition

Represents a collection of properties that can be added to DataColumn, DataSet, or DataTable.

public ref class PropertyCollection : System::Collections::Hashtable
public class PropertyCollection : System.Collections.Hashtable
type PropertyCollection = class
    inherit Hashtable
Public Class PropertyCollection
Inherits Hashtable
Inheritance
PropertyCollectionPropertyCollectionPropertyCollectionPropertyCollection

Examples

The following example creates a timestamp value for a DataTable and adds it to the PropertyCollection.

private void AddTimeStamp()
{
    //Create a new DataTable.
    DataTable table = new DataTable("NewTable");

    //Get its PropertyCollection.
    PropertyCollection properties = table.ExtendedProperties;

    //Add a timestamp value to the PropertyCollection.
    properties.Add("TimeStamp", DateTime.Now);

    // Print the timestamp.
    Console.WriteLine(properties["TimeStamp"]);
}
Private Sub AddTimeStamp()
    'Create a new DataTable.
    Dim table As New DataTable("NewTable")

    'Get its PropertyCollection.
    Dim properties As PropertyCollection = table.ExtendedProperties

    'Add a timestamp value to the PropertyCollection.
    properties.Add("TimeStamp", DateTime.Now)

    'Print the timestamp.
    Console.WriteLine(properties("TimeStamp"))
End Sub 

Remarks

The PropertyCollection can be accessed through the ExtendedProperties property of the DataColumn, DataSet, or DataTable class.

Add custom properties to the DataColumn, DataSet, or DataTable objects through the PropertyCollection. For example, you may want to store the time of the object's creation for later comparison to another object.

Constructors

PropertyCollection() PropertyCollection() PropertyCollection() PropertyCollection()

Initializes a new instance of the PropertyCollection class.

PropertyCollection(SerializationInfo, StreamingContext) PropertyCollection(SerializationInfo, StreamingContext) PropertyCollection(SerializationInfo, StreamingContext) PropertyCollection(SerializationInfo, StreamingContext)

Initializes a new instance of the PropertyCollection class.

Methods

Add(Object, Object) Add(Object, Object) Add(Object, Object) Add(Object, Object)

Adds an element with the specified key and value into the Hashtable.

(Inherited from Hashtable)
Clear() Clear() Clear() Clear()

Removes all elements from the Hashtable.

(Inherited from Hashtable)
Clone() Clone() Clone() Clone()

Creates a shallow copy of the PropertyCollection object.

Contains(Object) Contains(Object) Contains(Object) Contains(Object)

Determines whether the Hashtable contains a specific key.

(Inherited from Hashtable)
ContainsKey(Object) ContainsKey(Object) ContainsKey(Object) ContainsKey(Object)

Determines whether the Hashtable contains a specific key.

(Inherited from Hashtable)
ContainsValue(Object) ContainsValue(Object) ContainsValue(Object) ContainsValue(Object)

Determines whether the Hashtable contains a specific value.

(Inherited from Hashtable)
CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

Copies the Hashtable elements to a one-dimensional Array instance at the specified index.

(Inherited from Hashtable)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an IDictionaryEnumerator that iterates through the Hashtable.

(Inherited from Hashtable)
GetHash(Object) GetHash(Object) GetHash(Object) GetHash(Object)

Returns the hash code for the specified key.

(Inherited from Hashtable)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

Implements the ISerializable interface and returns the data needed to serialize the Hashtable.

(Inherited from Hashtable)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
KeyEquals(Object, Object) KeyEquals(Object, Object) KeyEquals(Object, Object) KeyEquals(Object, Object)

Compares a specific Object with a specific key in the Hashtable.

(Inherited from Hashtable)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object)

Implements the ISerializable interface and raises the deserialization event when the deserialization is complete.

(Inherited from Hashtable)
Remove(Object) Remove(Object) Remove(Object) Remove(Object)

Removes the element with the specified key from the Hashtable.

(Inherited from Hashtable)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Properties

comparer comparer comparer comparer

Gets or sets the IComparer to use for the Hashtable.

(Inherited from Hashtable)
Count Count Count Count

Gets the number of key/value pairs contained in the Hashtable.

(Inherited from Hashtable)
EqualityComparer EqualityComparer EqualityComparer EqualityComparer

Gets the IEqualityComparer to use for the Hashtable.

(Inherited from Hashtable)
hcp hcp hcp hcp

Gets or sets the object that can dispense hash codes.

(Inherited from Hashtable)
IsFixedSize IsFixedSize IsFixedSize IsFixedSize

Gets a value indicating whether the Hashtable has a fixed size.

(Inherited from Hashtable)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Gets a value indicating whether the Hashtable is read-only.

(Inherited from Hashtable)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

Gets a value indicating whether access to the Hashtable is synchronized (thread safe).

(Inherited from Hashtable)
Item[Object] Item[Object] Item[Object] Item[Object]

Gets or sets the value associated with the specified key.

(Inherited from Hashtable)
Keys Keys Keys Keys

Gets an ICollection containing the keys in the Hashtable.

(Inherited from Hashtable)
SyncRoot SyncRoot SyncRoot SyncRoot

Gets an object that can be used to synchronize access to the Hashtable.

(Inherited from Hashtable)
Values Values Values Values

Gets an ICollection containing the values in the Hashtable.

(Inherited from Hashtable)

Explicit Interface Implementations

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

(Inherited from Hashtable)

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See Also