DataSet.ShouldSerializeTables Method

Definition

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

Returns

true if the property value has been changed from its default; otherwise, false.

Examples

The following example shows a class derived from the DataSet class. 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

Remarks

You typically use this method only if you are either creating a designer for the DataSet, or creating your own control incorporating the DataSet.

Applies to

See also