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時,您通常會使用這個方法。

適用於

另請參閱