Tech Off Post

Single Post Permalink

View Thread: null + null = ?
  • User profile image
    Kenneth.L

    Londoner wrote:
    Here is another one for you:

    class Class1
    {
          public int c = true;  // <---- It compiles!!
           
          public Class1(): this(0) {}
          public Class1(int i): this() {} 
          [STAThread]
          static void Main(string[] args)
          {
                 
          }
    }


    The first, the "public int c = true; " is front of the constructor, so that it will be initialized before them.

    The second, true equals 0 and false equals 1 in some way like bit of SqlDbType.