DataTable HasRows Method

DataTable Extentions.
Add Methods to Objects.

So, it's getting me tired to always right:
     if (dt != null && dt.Rows.Count > 0)
to make sure that a certain table really have rows.

So here is an extension I added to the DataTable object:
        public static bool HasRows(this DataTable dt)
            if (dt != null && dt.Rows.Count > 0) 
                return true;
            return false;

Simple, yet efficient :)
Elad Shalom,
CTO at


  1. After approaching several street banks, they almost gave up through these loans, the offered
    loan sum ranges from 100 to 1500 pounds with repayment
    use of three months.


Post a Comment

Popular posts from this blog

Linked Files in Visual Studio 2010

Protecting Personal Data

SEO One On One - Web of Links