C # bool? The meaning

Source: Internet
Author: User

bool?is nullable bool .

bool? first;bool second;

In the above code, would be is while would be first null second false .

?the symbol after a type was only a shortcut to the Nullable type, was bool? equivalent to Nullable<bool> .

boolis a value of type, this means the it cannot being null , so the Nullable type basically allows your to wrap value types, and be ing able to assign to null them.

bool?Can contain three different values: true , false and null .

X y X&Y x|YTrue True True TrueTrue False False TrueTrue Null Null TrueFalse True False TrueFalse False false falsefalse null false nullnull  null truenull false false  nullnullnull null null 


Ref:https://stackoverflow.com/questions/1181491/whats-the-difference-between-bool-and-bool

C # bool? The meaning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.