DataColumn.ExtendedProperties 属性

定义

获取与 DataColumn 相关的自定义用户信息的集合。Gets the collection of custom user information associated with a DataColumn.

public:
 property System::Data::PropertyCollection ^ ExtendedProperties { System::Data::PropertyCollection ^ get(); };
public System.Data.PropertyCollection ExtendedProperties { get; }
[System.ComponentModel.Browsable(false)]
public System.Data.PropertyCollection ExtendedProperties { 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

属性值

自定义信息的 PropertyCollectionA PropertyCollection of custom information.

属性

示例

下面的示例将自定义属性添加到 ExtendedProperties 属性返回的 PropertyCollectionThe 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.

扩展属性的类型必须为 StringExtended properties must be of type String. DataColumn 写入为 XML 时,不会保留不属于 String 类型的属性。Properties that are not of type String are not persisted when the DataColumn is written as XML.

适用于

另请参阅