Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

PropertyCollection Class

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

System.Object
  System.Collections.Hashtable
    System.Data.PropertyCollection

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)
[SerializableAttribute]
public class PropertyCollection : Hashtable

The PropertyCollection type exposes the following members.

  NameDescription
Public methodSupported by the XNA FrameworkPropertyCollection()Initializes a new instance of the PropertyCollection class.
Protected methodPropertyCollection(SerializationInfo, StreamingContext)Initializes a new instance of the PropertyCollection class.
Top
  NameDescription
Protected propertySupported by the XNA Frameworkcomparer Obsolete. Gets or sets the IComparer to use for the Hashtable. (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkCountGets the number of key/value pairs contained in the Hashtable. (Inherited from Hashtable.)
Protected propertySupported by the XNA FrameworkEqualityComparerGets the IEqualityComparer to use for the Hashtable. (Inherited from Hashtable.)
Protected propertySupported by the XNA Frameworkhcp Obsolete. Gets or sets the object that can dispense hash codes. (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkIsFixedSizeGets a value indicating whether the Hashtable has a fixed size. (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkIsReadOnlyGets a value indicating whether the Hashtable is read-only. (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkIsSynchronizedGets a value indicating whether access to the Hashtable is synchronized (thread safe). (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkItemGets or sets the value associated with the specified key. (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkKeysGets an ICollection containing the keys in the Hashtable. (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkSyncRootGets an object that can be used to synchronize access to the Hashtable. (Inherited from Hashtable.)
Public propertySupported by the XNA FrameworkValuesGets an ICollection containing the values in the Hashtable. (Inherited from Hashtable.)
Top
  NameDescription
Public methodSupported by the XNA FrameworkAddAdds an element with the specified key and value into the Hashtable. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkClearRemoves all elements from the Hashtable. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkCloneCreates a shallow copy of the Hashtable. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkContainsDetermines whether the Hashtable contains a specific key. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkContainsKeyDetermines whether the Hashtable contains a specific key. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkContainsValueDetermines whether the Hashtable contains a specific value. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkCopyToCopies the Hashtable elements to a one-dimensional Array instance at the specified index. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetEnumeratorReturns an IDictionaryEnumerator that iterates through the Hashtable. (Inherited from Hashtable.)
Protected methodSupported by the XNA FrameworkGetHashReturns the hash code for the specified key. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetObjectDataImplements the ISerializable interface and returns the data needed to serialize the Hashtable. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkKeyEqualsCompares a specific Object with a specific key in the Hashtable. (Inherited from Hashtable.)
Protected methodSupported by the XNA FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodOnDeserializationImplements the ISerializable interface and raises the deserialization event when the deserialization is complete. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkRemoveRemoves the element with the specified key from the Hashtable. (Inherited from Hashtable.)
Public methodSupported by the XNA FrameworkToStringReturns a string that represents the current object. (Inherited from Object.)
Top
  NameDescription
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIEnumerable.GetEnumeratorReturns an enumerator that iterates through a collection. (Inherited from Hashtable.)
Top

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.

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"]);
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.