Answer Posted / benjamin janecke
String is a reference type but it behaves somewhat like a
value type. So it's a bit tricky and many developers don't
know it.
Great care should be taken when doing excessive string
manipulations with the String class. As already posted,
each String is read only and can never be changed. Thus,
every manipulation creates a new instance (and causes the
garbage collector to remove old ones) which can have a
dramatic performance impact on an application. Therefore,
always use the StringBuilder class in these scenarios,
which holds only one representation of a string in memory
and performs any changes directly to that memory block.
Btw. for those who don't belive String is a reference type,
just refer to MSDN or run ILDASM und load the mscorlib.dll
module from the .NET Framework. Then go to System.String
and u'll notice it's directly inherited from System.Object -
contrary to, for instance, the System.Byte class which is
inhertied from System.ValueType, meaning Byte is a value
type, String is not.
| Is This Answer Correct ? | 36 Yes | 2 No |
Post New Answer View All Answers
Describe paging in asp.net?
Describe how to implement globalization and localization in the use interface in .net.
what is meant by sitemapnode ?
What are the differences between code behind and code inline?
How to bind all the binding controls in a page at once in ASP.NET?
How will you do windows authentication and what is the namespace? If a user is logged under integrated windows authentication mode, but he is still not able to logon, what might be the possible cause for this? In ASP.Net application how do you find the name of the logged in person under windows authentication?
What is connection pooling and how to enable and disable connection pooling?
Explain ViewState?
What is enableviewstatemac in asp net?
How do you secure your configuration files to be accessed remotely by unauthorized users?
Is it possible to create web application with both webforms and mvc?
When using the Pager object, inorder to know which page to go, which property you have to set to grid?
1.how to encrpt query string in asp.net? 2.there are 10000 records then i wnat display 5000 records one gridview and 5000 records another grid view what is the process?
What is runat?
Where web.config file is used?