List <DataRow> count rows


I am trying to count the rows of a List -DataRow.

My initial search came up blank, so I decided to convert the DataRow into a DataTable, then perform a ‘dt.Rows.Count.ToString’, which worked great, except for when the list was blank.

Could someone explain how to perform either of these please (to resolve my issue):

  1. How to perform Bollean, is ‘List -DataRow’ blank
  2. How to count rows in a ‘List -DataRow’
  3. How to convert a ‘List -DataRow’ to a DataTable, even if the List is blank

I need this, as I have an IF statement which says if it is NULL, then do A, else do B.


Hope the following helps you.