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 / who am i

how do you explain this?

private void MyTest()
{
MyClass myClass = new MyClass();
myClass.value = 1;
MessageBox.Show(myClass.value.ToString()); //1
MyClass newClass = myClass;

newClass.value = 2;
MessageBox.Show(myClass.value.ToString()); //2


String myStr = new String("1".ToCharArray());

MessageBox.Show(myStr); //1
String newStr = myStr;

newStr = "2";
MessageBox.Show(myStr); //1 -- Shouldn't it
display 2???
}

public class MyClass
{
public int value=0;

}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c sharp used for?

833


Explain inheritance in c#?

895


When do you generally use a class over a struct?

914


What is the difference between ref & out parameters in c#?

878


What is garbage collection? How to force garbage collector to run?

846


Why are local variables stored in stack?

966


Do void methods have parameters?

900


How many types of inheritance are there in c#?

858


How much time will it take to learn unity?

869


What is a boolean c#?

843


Write a C# program to find the Factorial of n

925


Explain deadlock?

912


What is a private method in c#?

961


What are predicates in c#?

890


What is concatenation and when should it be used?

948