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

In C#, explain the difference between overloading and overriding.

1044


Define clr in .net?

930


What is private class in c#?

869


What is Reflection in .NET? Namespace? How will you load an assembly which is not referenced by current assembly?

921


What is the difference between hashtable and dictionary in c#?

881


What does f mean in c#?

870


What does async mean in c#?

932


Is clr a compiler?

817


Can we have 2 main methods in c#?

858


Do unused Namespaces in c# affect run-time performance?

983


What is the c# equivalent of c++ catch (...), Which was a catch-all statement for any possible exception?

943


Can we declare private class in c#?

868


Explain anonymous type in c#?

916


What is JIT (just in time)? how it works?

936


Can a sealed class be used as a base class?

915