This documentation is archived and is not being maintained.

PropertyCollection Class

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

For a list of all members of this type, see PropertyCollection Members.


[Visual Basic]
Public Class PropertyCollection
   Inherits Hashtable
public class PropertyCollection : Hashtable
public __gc class PropertyCollection : public Hashtable
public class PropertyCollection extends Hashtable

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


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.


[Visual Basic, C#, C++] The following example creates a timestamp value for a DataTable and adds it to the PropertyCollection.

[Visual Basic] 
Private Sub AddTimeStamp()
    Dim p As PropertyCollection
    'Create a new DataTable.
    Dim dt As New DataTable("myNewTable")
    'Get its PropertyCollection.
    p = dt.ExtendedProperties
    'Add a timestamp value to the PropertyCollection.
    p.Add("myTimeStamp", DateTime.Now)
    'Print the timestamp.
End Sub 'AddTimeStamp

private void AddTimeStamp(){
    PropertyCollection p;
    //Create a new DataTable.
    DataTable dt = new DataTable("myNewTable");
    //Get its PropertyCollection.
    p = dt.ExtendedProperties;
    //Add a timestamp value to the PropertyCollection.
    p.Add("myTimeStamp", DateTime.Now);
    // Print the timestamp.

void AddTimeStamp(){
    PropertyCollection* p;
    //Create a new DataTable.
    DataTable* dt = new DataTable(S"myNewTable");
    //Get its PropertyCollection.
    p = dt->ExtendedProperties;
    //Add a timestamp value to the PropertyCollection.
    // Print the timestamp.

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Data

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System.Data (in System.Data.dll)

See Also

PropertyCollection Members | System.Data Namespace | DataColumn | DataSet | DataTable | DataColumn.ExtendedProperties | DataSet.ExtendedProperties | DataTable.ExtendedProperties