Other than what has been already pointed out..."code trimming" for lesser cycles, I also suggest not to use the string literals as such. They break the clients when modified. static readonly string colName = "Number"; static readonly string colVal = "1"; -------------------------- if(dt != null && dt.Rows.Count > 0) { return dt.Rows[0][colName].ToString().Equals(colVal); } else return false;