DataTable.Copy Yöntem
Tanım
public:
System::Data::DataTable ^ Copy();
public System.Data.DataTable Copy ();
member this.Copy : unit -> System.Data.DataTable
Public Function Copy () As DataTable
Döndürülenler
DataTableAynı yapıyla (tablo şemaları ve kısıtlamalar) ve verilerle birlikte yeni bir DataTable .A new DataTable with the same structure (table schemas and constraints) and data as this DataTable.
Bu sınıflar türetildiyse, kopya aynı türetilmiş sınıflardan da olacaktır.If these classes have been derived, the copy will also be of the same derived classes.
Copy()DataTableorijinalle aynı yapıyla ve verilerle yeni bir oluşturur DataTable .Copy() creates a new DataTable with the same structure and data as the original DataTable. Yapıyı yeni bir veri değil, yeni bir öğesine kopyalamak için DataTable kullanın Clone() .To copy the structure to a new DataTable, but not the data, use Clone().
Örnekler
Aşağıdaki örnek, Copy özgün bir kopyasını oluşturmak için yöntemini kullanır DataTable .The following example uses the Copy method to create a copy of the original DataTable. Ad alanı adı bir üst öğeden devralınmışsa korunmaz DataTable DataSet .The namespace name is not retained if it is inherited from a parent DataTable or DataSet.
private void CopyDataTable(DataTable table){
// Create an object variable for the copy.
DataTable copyDataTable;
copyDataTable = table.Copy();
// Insert code to work with the copy.
}
Private Sub CopyDataTable(ByVal table As DataTable )
' Create an object variable for the copy.
Dim copyDataTable As DataTable
copyDataTable = table.Copy()
' Insert code to work with the copy.
End Sub