DataSet.ShouldSerializeTables 方法

定义

获取一个值,该值指示是否 Tables 应保留属性。

protected:
 virtual bool ShouldSerializeTables();
protected virtual bool ShouldSerializeTables();
abstract member ShouldSerializeTables : unit -> bool
override this.ShouldSerializeTables : unit -> bool
Protected Overridable Function ShouldSerializeTables () As Boolean

返回

true 如果属性值已从默认值更改,则为 ;否则,为 false.

示例

以下示例演示从该类派生的 DataSet 类。 从 ShouldSerializeTables 派生类中的函数中调用该方法。

public  class DerivedDataSet:System.Data.DataSet
{
    public void ResetDataSetRelations()
    {
        // Check the ShouldPersistTable method
        // before invoking Reset.
        if(!this.ShouldSerializeTables())
        {
            this.Reset();
        }
    }
}
Public Class DerivedDataSet
    Inherits System.Data.DataSet
    
    Public Sub ResetDataSetRelations()
        ' Check the ShouldPersistTable method 
        ' before invoking Reset.
        If Not Me.ShouldSerializeTables() Then
            Me.Reset()
        End If
    End Sub
End Class

注解

通常仅当为 DataSet 创建设计器或创建包含 DataSet 的控件时,才使用此方法。

适用于

另请参阅