How to convert “0” and “1” to false and true

前端 未结 9 668
無奈伤痛
無奈伤痛 2021-02-06 19:59

I have a method which is connecting to a database via Odbc. The stored procedure which I\'m calling has a return value which from the database side is a \'Char\'. Right now I\'

9条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 20:46

    You can use that form:

    return returnValue.Equals("1") ? true : false;
    

    Or more simply (thanks to Jurijs Kastanovs):

    return returnValue.Equals("1");
    

提交回复
热议问题