| .NET Framework 类库 |
克隆 DataTable 的结构,包括所有 DataTable 架构和约束。
[Visual Basic] Public Overridable Function Clone() As DataTable [C#] public virtual DataTable Clone(); [C++] public: virtual DataTable* Clone(); [JScript] public function Clone() : DataTable;
返回值
新的 DataTable,与当前的 DataTable 具有相同的架构。
备注
注意 如果这些类已经过派生,则副本也具有相同的派生类。
示例
[Visual Basic, C#, C++] 以下示例创建 DataTable 对象架构的复本。
[Visual Basic] Private Sub GetClone(ByVal myDataTable As DataTable) ' Get a clone of the original DataTable. Dim cloneTable As DataTable cloneTable = myDataTable.Clone() ' Insert code to work with clone of the DataTable. End Sub [C#] private void GetClone(DataTable myDataTable){ // Get a clone of the original DataTable. DataTable cloneTable; cloneTable = myDataTable.Clone(); // Insert code to work with clone of the DataTable. } [C++] private: void GetClone(DataTable* myDataTable){ // Get a clone of the original DataTable. DataTable* cloneTable; cloneTable = myDataTable->Clone(); // Insert code to work with clone of the DataTable. }
[JScript] 没有可用于 JScript 的示例。若要查看 Visual Basic、C# 或 C++ 示例,请单击页左上角的“语言筛选器”按钮
。
要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列, .NET Framework 精简版
博客介绍了 DataTable.Clone 方法,该方法可克隆 DataTable 的结构,包括架构和约束,返回与当前 DataTable 有相同架构的新 DataTable。还给出了 Visual Basic、C#、C++ 的示例,同时说明了该方法的平台要求。

3308

被折叠的 条评论
为什么被折叠?



