DataSet.ShouldSerializeRelations 方法

定義

取得值,表示是否應該保存 Relations 屬性。

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

傳回

如果屬性值已經從其預設值變更,則為 true,否則為 false

範例

下列範例顯示衍生自 類別的 DataSet 類別。 ResetShouldSerializeRelations 方法是從衍生類別的函式內叫用。

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

備註

如果您要建立設計工具 DataSet,或建立自己的控制項併 DataSet入 ,您通常會使用這個方法。

適用於

另請參閱