Is string reference type / value type?

Answer Posted / baranee

Hi,

String is a value type but its not advisable to use for the
frequent usage of string.String is a class which has
default size of 16.If the value exceeds it will create one
more instance and left the old reference which is still not
cleared in memory. So we can use stringbuilder value type
which doubles the size when the default size exceeds.

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to have different access modifiers on the get/set methods of a property?

523


Name some properties of array.

493


what is partial assembly reference

517


What is ulong in c#?

582


What are jagged arrays used for?

490






Explain the difference between const and static read-only?

516


What is the Signification of the "new " keyword in C#? example

535


Value Type and Reference Type Data type in C#?

561


What's the difference between system.string and system.text.stringbuilder classes?

535


What is the use of functional interface?

491


Explain the difference between a struct and a class?

516


Can a static class have a constructor c#?

493


Why is aws serverless?

507


Which function is the entry point for a DLL in MS Windows 3.1?

686


In which way a two-dimensional array declared in C#?

514