Is string reference type / value type?

Answer Posted / malli

String Is Reference Type Ex

string StrName1 = "Test";
string StrName2 = StrName1;
StrName2="Test1";
Console.WriteLine("StrName1="+StrName1);
Console.WriteLine("StrName1=" + StrName2);

Object objStrName1 = "Test";
Object objStrName2 = objStrName1;
objStrName2 = objStrName1;
objStrName2 = "Test1";
Console.WriteLine("objStrName1=" + objStrName1);
Console.WriteLine("objStrName2=" + objStrName2);
Console.WriteLine("Malli");

OutePut:-

StrName1=Test
StrName1=Test1
objStrName1=Test
objStrName2=Test1

No More Discusion...

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by 'access specifiers' in C#?

524


What is an Interface in C#?

546


How to implement singleton design pattern in c#?

476


What is meant by desktop application?

501


what are some characteristics of an array?

525






Can we inherit private members of class in c#?

583


What is the use of 'as' Keyword in C# ?

580


What is thread.sleep()?

516


What is xml comments in c#?

494


Why delegates are required?

539


What is a base class in C#?

561


What is a collection in c#?

511


What is yield break in c#?

510


What is the use of 'using' statement in c#?

487


Explain how to parse a datetime string?

506