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
How big is an int in c#?
How do you pass reference parameters in c#?
Why would you use a class property in c#?
What is immutable in C#?
What is c# best for?
What does int32 mean?
What is the difference between namespace and class?
What is asenumerable in c#?
How do you serialize in c#?
How many types of constructors are there?
How do you specify a custom attribute for the entire assembly (rather than for a class)?
Can abstract class have constructor c#?
What's new in c#?
What does break do in loop?
List some of the basic string operation?