Is there a difference between DataTable.Clear and DataTable.Rows.Clear?

后端 未结 7 1574
天涯浪人
天涯浪人 2021-01-18 06:51

I recall there is a difference between some methods/properties called directly on the DataTable class, and the identically named methods/properties on the DataTable.Rows pro

7条回答
  •  余生分开走
    2021-01-18 07:24

    I don't believe that DataTable.Clear does clear columns. This code writes "1" to standard output:

    var d = new DataTable();
    d.Columns.Add("Hello", typeof(string));
    d.Clear();
    Console.WriteLine(d.Columns.Count);
    

提交回复
热议问题