Is string a value type or a reference type?

Answer Posted / sheetal shivdas

run this code : to see that string is reference type


SByte a = 0;
Byte be = 0;
Int16 c = 0;
Int32 d = 0;
Int64 ee = 0;
String s = "";
Exception ex = new Exception();

object[] Types = { a, be, c, d, ee, s,ex };

foreach (object obj in Types)
{
string type;
if (obj.GetType().IsValueType)
type = "Value Type";
else
type = "Reference Type";
Response.Write(type);
}

Is This Answer Correct ?    32 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

there is two functions function a and function b like fun a(){.... ..... } fun b() { } in function b i write the coding to add two numbers and i need to dispaly the sum result in function a with out using global variable. how we do?

2234


What are the different method of navigation in asp.net?

571


What is httpresponse?

518


What is the life cycle of web page?

529


Define static constructor?

560






Can anyone please tell me that the question posted on this website are Sufficient for the interview with 2+ year experience in .net

1509


Do you support digital rights management to protect my videos?

459


How can we inherit a static variable?

548


What are app services?

534


What is the difference between globalization and localization?

493


How does session state work in asp.net?

509


Define application state variable and session state variable?

560


Explain the differences between managed and unmanaged code?

502


What is __ requestverificationtoken?

555


What is http post and http get?

548