HasRecords

    <System.Runtime.CompilerServices.Extension()> _
    Public Function HasRecords(ByVal dt As DataTable) As Boolean
        Return dt.Rows.Count > 0
    End Function
Example:
        Dim table As DataTable = New DataTable()
        With table.Columns
            .AddRange(New DataColumn() _
               { _
                  New DataColumn("ID", System.Type.GetType("System.String")), _
                  New DataColumn("FirstName", System.Type.GetType("System.String")), _
                  New DataColumn("LastName", System.Type.GetType("System.String")) _
               } _
            )
        End With

        table.Rows.Add(New Object() {"100", "Mary", "Smith"})

        If table.HasRecords Then
            Console.WriteLine("     Yes")
        Else
            Console.WriteLine("No")
        End If

        table.Rows.RemoveAt(0)

        If table.HasRecords Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If

Description

The idea is to have a method which spells out a question, are there any records which for some might be reading code easier

Details

Double click on the code to select all.

 

;