Is string a value type or a reference type?

Answer Posted / chandrapal singh

string is value type by nature. it does not follow rules
of reference type. eg

string MyName1 = "chandrapal Singh";
string MyName2;

MyName2 = MyName1;
MyName2 = "deepak";

Response.Write("MyName1 :" + MyName1 + " MyName2 :" +
MyName2);

This gives Output
MyName1 :chandrapal Singh MyName2 :deepak

if this is reference type then the output should be
MyName1 :deepak MyName2 :deepak

Is This Answer Correct ?    7 Yes 29 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

code for "For every 5days system has to create 1text file with the corresponding date and it has to store in c-drive" by using web applications

1413


How is a session stored and maintained in asp.net?

537


What is distributed system in asp.net?

541


How is mvc different from asp.net? : Asp.Net MVC

552


What is the use of worker process in asp.net?

529






What is view state and how it works in asp net?

550


Explain transparent caching with aop?

523


Define view state.

552


Give an example of cookie abuse.

599


Explain the code Access Security (CAS) in .net Framework?

680


i want to implement grid view value in paypal site. so how to create this code in asp.net with C#

1499


What are the various ways to send content from one page to another?

522


What is the use of global.asax file?

546


What is manifest in .net framework?

540


What is the use of session?

524