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
What is the use of parse in c#?
Can constructor be protected?
Is array reference type in c#?
What is the relationship between a process, application domain, and application?
What does using do in c#?
Difference between value and reference type.
What are events in C#?
How are methods overloaded?
How many bytes is a long c#?
Explain dataset.acceptchanges method in .net?
For read-only operation which property you have to designated?
What is the boxing and unboxing in c#?
Is functional interface runnable?
Can int be null in c#?
Is learning c# hard?