There is no difference with value types (Integer, Double, Structures, ...).
The instance is created anyway in both cases.
There is a difference with reference types: Without new, only the space for
the variable is reserved (currently 4 bytes = 32 bits). No object is
created. The variable contains Nothing (= no reference). With New, it is
equal to
dim o as type
o = new type
which means it also creates an object and stores the reference to the object
in o.
-This declare the objSome but memory was not allocated.
Dim objSome as new Something
-This declare and allocate memory for the object.
:new is the keyword in .net to allocate memory for the declared object.
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.