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 me what are the deferred execution and the immediate execution in linq?

0 Answers  


How will you load an assembly which is not referenced by current assembly?

0 Answers  


How do you instantiate a complex number?

0 Answers  


What is nmake tool?

1 Answers  


What is managed code in .NET?

0 Answers  






Explain how garbage collection works?

0 Answers  


Explain the use of ‘this’ keyword in Java?

1 Answers  


What are the difference bbetween value type & reference types ? Example from .net. Integer & struct are value types or reference types in .net?

0 Answers  


Explain the different parts of an assembly?

0 Answers  


How is a managed code executed?

1 Answers  


What tools is used to develop .NET applications?

0 Answers  


Please explain about "this" object

4 Answers   CTS,


Categories