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

What are the differences between application object and session object?

710


What are assemblies and namespaces and explain the difference between them ?

797


How can you access the properties and controls of master pages from content pages?

726


Explain the asp.net session state modes.

807


What are query strings used for?

713






How can you handle exceptions in asp.net?

742


What are the Difference between asp.net and asp ?

753


How is it possible for .NET to support many languages?

478


Please brief not about xsd,xslt & xml?

731


Hi this is the coding for adding data in to an xml table i want the coding for update and delete Try Dim emp_xml_doc As New XmlDocument If System.IO.File.Exists(Server.MapPath("emp.xml")) Then emp_xml_doc.Load(Server.MapPath("emp.xml")) Dim myrow_element As XmlElement myrow_element = emp_xml_doc.CreateElement("EmpDetails") Dim str As String str = "" & TxtEmpId.Text & "" & _ "" & TxtName.Text & "" & _ "" & TxtSalary.Text & "" myrow_element.InnerXml = str emp_xml_doc.DocumentElement.AppendChild(myrow_element) emp_xml_doc.Save(Server.MapPath("emp.xml")) Response.Write("Record Saved") Dim ds As New DataSet ds.ReadXml(Server.MapPath("emp.xml")) GridView1.DataSource = ds GridView1.DataBind() Else Response.Write("File does not exist.") End If Catch ex As Exception Response.Write(ex.ToString) End Try *********************** this is the xml file 100 xxx 2000 yyy dddd 77777 rrrr rrrr 6666 qaqa sini 50000 errrrrrrrr rrrrrrrrr 677777 rrr rrr 33

1917


How to create multi language website in asp.net mvc? : Asp.Net MVC

667


What is caching in asp.net?

737


What tags do you need to add within the asp:datagrid tags to bind columns manually? How?

716


What are the main differences between asp and asp.net?

711


14. What are your Future Plans for Swatz Oils GROUP U.K?

1945