Is string a value type or a reference type?

Answers were Sorted based on User's Feedback



Is string a value type or a reference type?..

Answer / suhasini suresh

It is a reference type

Is This Answer Correct ?    4 Yes 0 No

Is string a value type or a reference type?..

Answer / prashant mishra

string is a reference type data type

Is This Answer Correct ?    2 Yes 0 No

Is string a value type or a reference type?..

Answer / indrajeet kumar

string is the reference type of data.

Is This Answer Correct ?    2 Yes 0 No

Is string a value type or a reference type?..

Answer / rajneesh hajela

string is immutable

but stringbuildler are mutable...

this play many role


StringBuilder y = new StringBuilder();
y.Append("hello");

StringBuilder x = new StringBuilder();
x.Append("hello");

if (y == x)
{
}
// Stirng is immutable .In some ways it to
be value types .These are known as immutable .
//===================

string str1 = "hello";
string str2 = "hello";

if (str1 == str2)
{
}
//===============
string y1 ="";
y1="hello";

Program p = new Program();
p.foo(ref y1);
Console.WriteLine(y1);

}

void foo(ref string sb)
{
sb="Rajneesh Hajela:";
}


Rajneesh Hajela

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net General Interview Questions

how to connect database connectivity in dotNET? if suppose SQL server?and also MS access?

8 Answers  


where are connection strings stored?

1 Answers   Manhattan,


Please explain what are an object and a class?

0 Answers  


Do you know the difference between the stack and the heap?

0 Answers  


What method do you use to explicitly kill a users session? How?

0 Answers  






What does il do?

0 Answers  


Describe the difference between inline and code behind which is best in a loosely coupled solution?

1 Answers  


Explain me why do we use msmq?

0 Answers  


Explain how com+ related to the dna architecture?

0 Answers  


Why inheritance is important?

0 Answers  


How to Create and Consume a Web Service?

1 Answers  


Explain the different parts of an assembly?

0 Answers  


Categories