DataSet.ShouldSerializeTables DataSet.ShouldSerializeTables DataSet.ShouldSerializeTables DataSet.ShouldSerializeTables Method

定义

获取一个值,该值指示是否应该保持 Tables 属性。Gets a value indicating whether Tables property should be persisted.

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;否则为 falsetrue if the property value has been changed from its default; otherwise, false.

示例

下面的示例演示一个派生自DataSet类的类。The following example shows a class derived from the DataSet class. ShouldSerializeTables派生类中的函数中调用方法。The ShouldSerializeTables method is called from within functions in the derived class.

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包含的控件时,才使用此方法。You typically use this method only if you are either creating a designer for the DataSet, or creating your own control incorporating the DataSet.

适用于

另请参阅