Dumping DataTable to debug window
Join the DZone community and get the full member experience.
Join For FreeHere’s one little method I use to write out debug information when
investigating a new (legacy but new to me) system. Usually I remove
this method later when I know how the code works. It’s maybe not the best
way to debug things, but it works like charm in many situations.
Hope it helps somebody :)
public void DumpDataTable(DataTable table) { foreach (DataRow row in table.Rows) { Debug.Print("------------------------------------------"); foreach (DataColumn col in results.Columns) { Debug.Write(col.ColumnName); Debug.Write("="); Debug.WriteLine(row[col.ColumnName]); } } }
Hope it helps somebody :)
Debug (command)
Published at DZone with permission of Gunnar Peipman, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments