DataColumn.ExtendedProperties DataColumn.ExtendedProperties DataColumn.ExtendedProperties DataColumn.ExtendedProperties Property

定義

取得與 DataColumn 相關聯的自訂使用者資訊集合。Gets the collection of custom user information associated with a DataColumn.

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 ExtendedProperties屬性所傳回的。The following example adds a custom property to the PropertyCollection returned by the ExtendedProperties property. 第二個範例會抓取自訂屬性。The second example retrieves the custom property.

   private void SetProperty(DataColumn column)
   {
       column.ExtendedProperties.Add("TimeStamp", DateTime.Now);
   }

   private void GetProperty(DataColumn column)
   {
       Console.WriteLine(column.ExtendedProperties["TimeStamp"].ToString());
   }
 Private Sub SetProperty(column As DataColumn)
     column.ExtendedProperties.Add("TimeStamp", DateTime.Now)
 End Sub    
    
 Private Sub GetProperty(column As DataColumn)
     Console.WriteLine(column.ExtendedProperties("TimeStamp").ToString())
End Sub

備註

ExtendedProperties屬性可讓您將自訂資訊與物件一起儲存。The ExtendedProperties property lets you store custom information with the object. 例如,您可以儲存資料應該重新整理的時間。For example, you may store a time when the data should be refreshed.

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

適用於

另請參閱