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 / ak

How do you explain this then?

public void MyTest()
{
Program myClass = new Program();
myClass.value = 1;
Console.Out.WriteLine(myClass.value.ToString
()); //1
Program newClass = myClass;

newClass.value = 2;
Console.Out.WriteLine(myClass.value.ToString
()); //2


myClass.strvalue = new String("1".ToCharArray
());

Console.Out.WriteLine(myClass.strvalue); //1
newClass.strvalue = myClass.strvalue;

newClass.strvalue = "2";
Console.Out.WriteLine(myClass.strvalue); //2
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are interfaces in c#?

908


What is a statement c#?

924


In how many ways you can overload a method?

1016


Define c# delegate?

960


What is the purpose of namespace in c#?

832


Is php easier than c#?

863


Can interface inherit class in c#?

942


Can we overload indexer in c#?

852


What is the difference between continue and break statement?

935


Is c sharp open source?

822


What are different types of classes in c#?

856


What are desktop applications examples?

907


What is binary search tree in data structure?

854


Differentiate between method overriding from method overloading with its functionality?

978


Define Virtual folder?

984