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
what is full assembly reference
What is the process of Serialization?
Does c# do array bounds checking?
When can a derived class override a base class member?
What is form feed in c#?
How do you comment out code in c#?
What is window application in c#?
Are c# constructors the same as c++ constructors?
Illustrate serialization?
Can list contain duplicates c#?
How do I move from one form to another in c#?
What is firstordefault c#?
what is IDisposal interface,IComparable,IEquatable,IFormatable
Define a manifest in .net?
What is the namespcae generally given to the webpage of the .NET Framework ?