DataTable.ExtendedProperties DataTable.ExtendedProperties DataTable.ExtendedProperties DataTable.ExtendedProperties Property

定義

取得自訂使用者資訊的集合。Gets the collection of customized user information.

public:
 property System::Data::PropertyCollection ^ ExtendedProperties { System::Data::PropertyCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
[System.Data.DataSysDescription("ExtendedPropertiesDescr")]
public System.Data.PropertyCollection ExtendedProperties { get; }
member this.ExtendedProperties : System.Data.PropertyCollection
Public ReadOnly Property ExtendedProperties As PropertyCollection

屬性值

PropertyCollection,含有自訂使用者資訊。A PropertyCollection that contains custom user information.

範例

下列範例會DataTable ExtendedProperties透過屬性,將時間戳記值新增至。The following example adds a timestamp value to the DataTable through the ExtendedProperties property.

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

備註

使用將自訂資訊新增DataTable至。 ExtendedPropertiesUse the ExtendedProperties to add custom information to a DataTable. 使用Add方法新增資訊。Add information with the Add method. 使用Item方法取出資訊。Retrieve information with the Item method.

擴充屬性的類型String必須是。Extended properties must be of type String. 當寫入為 XML 時DataTable ,不會保存非字串類型的屬性。Properties that are not of type String are not persisted when the DataTable is written as XML.

適用於

另請參閱