DataSet.ExtendedProperties 属性

定义

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

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 with all custom user 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 属性使你能够将自定义信息存储到 DataSet中。The ExtendedProperties property enables you to store custom information with the DataSet. 例如,您可以存储数据的刷新时间。For example, you might store a time when the data should be refreshed.

如果希望将 DataSet 编写为 XML,则扩展属性的类型必须为 StringExtended properties must be of type String if you want them persisted when the DataSet is written as XML.

适用于

另请参阅