Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Is string reference type / value type?

Answer Posted / n.

There is no magic.... You can test all the types:

using System;
using System.Collections.Generic;
using System.Text;

namespace List_Value_Types
{
class Program
{
static void Main(string[] args)
{
SByte a = 0;
Byte b = 0;
Int16 c = 0;
Int32 d = 0;
Int64 e = 0;
string s = "";
Exception ex = new Exception();

object[] types = { a, b, c, d, e, s, ex};

foreach (object o in types)
{
string type = "";
if (o.GetType().IsValueType)
type = "Value type";
else
type = "Reference type";

Console.WriteLine("{0}: {1}", o.GetType(),
type);
}
Console.ReadKey();
}
}
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is string a data type in c#?

796


What is the syntax for calling an overloaded constructor within a constructor?

905


What is Assembly. and Describe type of assembly. why most developer happy with private assembly.

915


what is the equivalent to regsvr32 and regsvr32 /u a file in .net development?

914


Can we declare class as protected?

920


What is the use of ispostback in c#?

821


What is windows forms in c#?

863


What is CLR and its application.?

989


What are the value types in c#?

898


what is the difference between .dll and .exe

968


what is the purpose of using statement in c#

954


What is the difference between console application and windows application?

943


What are the benefits of using generics?

917


Write a sample code to write the contents to text file in c#?

841


Can private virtual methods be overridden in c#.net?

850