DataSet.Clone DataSet.Clone DataSet.Clone DataSet.Clone Method

定义

复制 DataSet 的结构,包括所有 DataTable 架构、关系和约束。Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. 不要复制任何数据。Does not copy any data.

public:
 virtual System::Data::DataSet ^ Clone();
public virtual System.Data.DataSet Clone ();
abstract member Clone : unit -> System.Data.DataSet
override this.Clone : unit -> System.Data.DataSet
Public Overridable Function Clone () As DataSet

返回

DataSet,其架构与当前 DataSet 的架构相同,但是不包含任何数据。A new DataSet with the same schema as the current DataSet, but none of the data.

示例

下面的示例创建DataSet对象的架构的克隆。The following example creates a clone of a DataSet object's schema.

private void GetClone(DataSet dataSet)
{
    // Get a clone of the original DataSet.
    DataSet cloneSet = dataSet.Clone();

    // Insert code to work with clone of the DataSet.
}
Private Sub GetClone(ByVal dataSet As DataSet)
   ' Get a clone of the original DataSet.
   Dim cloneSet As DataSet = dataSet.Clone()

   ' Insert code to work with clone of the DataSet.
End Sub

注解

备注

如果这些类已被细分,则克隆还会属于相同的子类。If these classes have been subclassed, the clone will also be of the same subclasses.

适用于

另请参阅