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

Explain what is the difference between web application and enterprise application?

0 Answers  


Explain can the validation be done in the server side? Or this can be done only in the client side?

0 Answers  


What is SOAP? How you will do windows and forms authentication?

0 Answers   Wipro,


If I am writing in a language like vb or c++, what are the procedures to be followed to support .net?

0 Answers  


In code behind class, name the type of code found. Is it the server side code or client side code?

0 Answers   Accenture,


Explain boxing and unboxing in .net.

0 Answers  


How does the generational garbage collector in the .net clr manage object lifetime? What is non-deterministic finalization?

0 Answers  


Give An example of a ctype and directcast.

2 Answers   Wipro,


What are the fundamental objects in ADO.NET?

1 Answers  


Explain different types of cookies in .NET?

1 Answers  


How would ASP and ASP.NET apps run at the same time on the same server?

1 Answers  


Difference between Debugging and tracing in .net

1 Answers  


Categories