locked
Error - The best overloaded method match for string.IsNullOrEmpty(string) has some invalid arguments RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have below code and when i write isnull condition then i get above error

    if (dt.Rows[i]["Name"] != DBNull.Value && string.IsNullOrEmpty(dt.Rows[i]["Name"]) == false)

    Thanks

    Saturday, September 8, 2018 4:47 AM

Answers

  • User839733648 posted

    Hi JagjitSingh,

    According to your description, I suggest that you could modify your code as below.

    (dt.Rows[i]["Name"] != DBNull.Value && string.IsNullOrEmpty(dt.Rows[i]["Name"].ToString()) == false)
    

    dt.Rows[i]["Name"] is not a normal string, so you should use .ToString() to transform it.

    Best Regards,

    Jenifer

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 10, 2018 10:35 AM