locked
Convert string zero and one to Boolean RRS feed

  • Question

  • Hi,

    I have my database returning zero and one as string and I want to convert it to Boolean like this:

    if (Convert.ToBoolean(App.getUserInfo("EAIsMember")) == true)


    How can Id o this please

    Thanks,

    Jassim - UAE Angel Investors


    • Edited by Jassim Rahma Thursday, September 17, 2020 10:39 PM
    Thursday, September 17, 2020 10:39 PM

Answers

  • Hi Jassim Rahma,

    Thanks for your feedback.

    Try uppercase 'Equals'.

    if ("1".Equals(App.getUserInfo("EAIsMember")))

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Jassim Rahma Tuesday, September 22, 2020 7:58 PM
    Monday, September 21, 2020 2:24 AM

All replies

  • Try this:

    if ("1".equals(App.getUserInfo("EAIsMember")))

    Friday, September 18, 2020 3:30 AM
    Answerer
  • Try this:

    if ("1".equals(App.getUserInfo("EAIsMember")))

    /Users/jassim/Projects/Angels/Angels/Angels/Settings.xaml.cs(21,21): Error CS1061: 'string' does not contain a definition for 'equals' and no accessible extension method 'equals' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Angels)

    Friday, September 18, 2020 6:36 PM
  • Hi Jassim Rahma,

    Thanks for your feedback.

    Try uppercase 'Equals'.

    if ("1".Equals(App.getUserInfo("EAIsMember")))

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Jassim Rahma Tuesday, September 22, 2020 7:58 PM
    Monday, September 21, 2020 2:24 AM
  • Yup. I'm doing Java projects lately, so forget to upcase the .Equals().
    Monday, September 21, 2020 6:31 AM
    Answerer
  • Hi Jassim Rahma,

    How is the question going? If your question has been answered then please click the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 22, 2020 8:57 AM