zoukankan      html  css  js  c++  java
  • C# bool? 的意思

    bool? is nullable while bool is not.

    bool? first;
    bool second;

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

    The ? symbol after a type is only a shortcut to the Nullable typebool? is equivalent to Nullable<bool>.

    bool is a value type, this means that it cannot be null, so the Nullable type basically allows you to wrap value types, and being able to assign null to them.

    bool? can contain three different values: truefalse and null.

    x        y      x & y   x | y   
    true    true    true    true
    true    false   false   true
    true    null    null    true
    false   true    false   true
    false   false   false   false
    false   null    false   null
    null    true    null    true
    null    false   false   null
    null    null    null    null


    REF: https://stackoverflow.com/questions/1181491/whats-the-difference-between-bool-and-bool
  • 相关阅读:
    CSU 1122
    CSU 1256
    CSU 1240
    HDU 1874
    CSU 1004
    Problem F CodeForces 16E
    Problem E CodeForces 237C
    Problem C FZU 1901
    12-30
    2016-12-29
  • 原文地址:https://www.cnblogs.com/watermarks/p/8469780.html
Copyright © 2011-2022 走看看