Export (0) Print
Expand All

DataTable.ExtendedProperties Property

Gets the collection of customized user information.

[Visual Basic]
Public ReadOnly Property ExtendedProperties As PropertyCollection
[C#]
public PropertyCollection ExtendedProperties {get;}
[C++]
public: __property PropertyCollection* get_ExtendedProperties();
[JScript]
public function get ExtendedProperties() : PropertyCollection;

Property Value

A PropertyCollection that contains custom user information.

Remarks

Use the ExtendedProperties to add custom information to a DataTable. Add information with the Add method. Retrieve information with the Item method.

Extended properties must be of type String. Properties that are not of type String are not persisted when the DataTable is written as XML.

Example

[Visual Basic, C#, C++] The following example adds a timestamp value to the DataTable through the ExtendedProperties property.

[Visual Basic] 
Private Sub GetAndSetExtendedProperties(ByVal myTable As DataTable)
   ' Add an item to the collection.
   myTable.ExtendedProperties.Add("TimeStamp", DateTime.Now)
   ' Print the item.
   Console.WriteLine(myTable.ExtendedProperties.Item("TimeStamp"))
End Sub

[C#] 
private void GetAndSetExtendedProperties(DataTable myTable){
   // Add an item to the collection.
   myTable.ExtendedProperties.Add("TimeStamp", DateTime.Now);
   // Print the item.
   Console.WriteLine(myTable.ExtendedProperties["TimeStamp"]);
}

[C++] 
private:
 void GetAndSetExtendedProperties(DataTable* myTable){
    // Add an item to the collection.
    myTable->ExtendedProperties->Add(S"TimeStamp",__box(DateTime::Now));
    // Print the item.
    Console::WriteLine(myTable->ExtendedProperties->Item[S"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.

Requirements

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

See Also

DataTable Class | DataTable Members | System.Data Namespace

Show:
© 2015 Microsoft