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

What is a metadata in .net?

0 Answers  


Explain the garbage collection process?

0 Answers  


Which is the main Difference Between .Net 2003 and .Net 2005?

1 Answers  


How will you load dynamic assembly? How will create assemblies at run time?

0 Answers   InfoAxon Technologies,


How do I spawn a thread?

0 Answers  






Where does the dispose method lie and how can it be used to clean up resources?

1 Answers   Wipro,


How to create properties and methods using controls?

0 Answers   CGI,


differance between checkbox and rediobutton in vb.net?

1 Answers  


What is CLR? How it will work?

3 Answers   NeoSoft,


Write the .net syntax for 'for loop'?

0 Answers  


Explain what is a delegate?

0 Answers  


DateTime[] dt = new DateTime[10] for(i=0; i<10; i++) { dt[i] = DateTime(2008, 1, i+1) } How many heap object will be created for the above array. Choose the correct answer below. Ans: 1, 10, 11, 12

3 Answers  


Categories