2 Replies Latest reply on Sep 16, 2014 8:13 PM by Di Anne

    initialization

    Di Anne

      Artem Taturevych


      Hello,

       

      Im just curious about the initialization..

      what is the difference between

       

      ModelDoc2 swModel = default(ModelDoc2);

      ModelDoc2 swModel = null;

      ModelDoc2 swModel;

       

      Thanks in advance.

        • Re: initialization
          Simon Turner

          They are effectively all the same.

          "default" assigns swModel to null (because for non-numeric types such as ModelDoc2, it uses null. For numeric types it sets them to 0). You'd almost never use that in practise though.

          Using the second option may prevent the compiler from warning about swModel not being defined before being used. But after compilation it is the same as option 3.