cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?)

前端 未结 9 694
陌清茗
陌清茗 2020-12-05 06:14

Error : cannot implicitly convert type \'bool?\' to \'bool\'. An explicit conversion exists (are you missing a cast?)

Code :



        
9条回答
  •  温柔的废话
    2020-12-05 06:44

    bool is not equal to bool?.

    bool can take two values, true and false.

    bool? can take three, true, false, and null.

    That is why they are different.

提交回复
热议问题