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
Explain the difference between abstract class and interface.
How is a strongly-named assembly different from one that isn’t strongly-named?
What is private protected in c#?
Which namespaces are necessary to create a localized application?
What is windows forms in c#?
What does the parsefloat function do?
What is the difference between structure and class in c#?
Why do we need nullable types in c#?
What is a delegate in c#?
Why do we override in c#?
Is boxing an implicit conversion?
Can properties be private in c#?
What are the fundamental differences between value types and reference types?
How does inheritance work in c#?
Explain how to use an extender provider in the project.