본문 바로가기
Programming/C#

[c#] DataTable Clone vs Copy

by 째스터 2021. 7. 8.
728x90

DataTable Clone()으로 복사했더니 DataRow가 하나도 없었다.
문서를 확인해보니 Copy()를 사용하라고 한다.

DataTable의 구조를 복사하려면 Clone()을 사용하고,
DataRow까지 복사하기 위해서는 Copy()를 사용하자!

Clone creates a new DataTable with the same structure as the original DataTable,
but does not copy any data (the new DataTable will not contain any DataRows).
To copy both the structure and data into a new DataTable, use Copy.

참고

728x90

'Programming > C#' 카테고리의 다른 글

[C#] List<T>를 ArrayList로 변환하기  (0) 2021.09.25
C# 10 Top 5 feature  (0) 2021.07.13
[C#] DataRow Clone하기  (0) 2021.06.29
[C#] SqlParameterCollection 에러  (0) 2021.06.14
[C#] IsNullOrEmpty vs IsNullOrWhiteSpace  (0) 2021.06.02

댓글