I have a question about string class. System.String is a class type, but why we can use it without instantiate it with New keyword?
For example:
Dim CommandLineParameters As String = Microsoft.VisualBasic.Interaction.Command
No new keyword being used at all
When you write
you are simply assigning a reference. Behind the scenes the compiler generates code to instantiate the string object that holds
"hello". That instantiation probably happens long before the assignment but the full details of that are another story.In summary, the code above does not instantiate an object.
Likewise, in your example:
no object is instantiated. All that happens is that a reference to an existing object is copied.