Редактиране

Споделяне чрез


DataSet.ShouldSerializeRelations Method

Definition

Gets a value indicating whether Relations property should be persisted.

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

Returns

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

Examples

The following examples show a class derived from the DataSet class. The Reset and ShouldSerializeRelations methods are invoked from within functions in the derived class.

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

Remarks

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

Applies to

See also