Difference between initializing a string and not initializing a string in .NET -


I want to know how to allocate memory when starting the string using new keywords and without string New keywords while setting the value for

Abhishek R.Sarasanth

There is no difference between the path Or when you set the string directly using '=', the memory is allocated on both stacks and therefore once the garbage collector is responsible for collecting memory, when it goes out of the scope . Only the new 'new' calls the constructor, whereas if you allocate using the directly overloaded operator and it starts a new instance of the string.

Comments