QuestionQ112

VerifiedData Manipulation

The following table is stored in a variable named dt.

Question Image

Which query can be used to retrieve the table’s column names and save them in a list?

Explanation

A DataTable exposes its columns through Columns. Casting that collection to DataColumn, selecting each ColumnName, and calling ToList() returns a list containing the column names.

Community Discussion

No comments yet. Be the first to start the discussion!