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才使用此方法。

适用于

另请参阅