DataSet.ShouldSerializeTables 方法
定义
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。true 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.