Hi there,
I've got a query about C# and returning reference types... if I have a class like :
class TestClass
{
private int aNumber = 3;
private string aString = "hello";
public int Number
{
get { return aNumber; }
set { aNumber = value; }
}
public String TheString
{
get { return aString; }
}
}
And I do the following :
TestClass testClass = new TestClass();
String aString = testClass.TheString;
System.Console.WriteLine( "String Value " + aString );
aString = "there";
System.Console.WriteLine( "Class String Value " + testClass.TheString );
The string value stored in the TestClass instance (testClass) isn't modified by :
aString = "there";
I thought that strings were a reference type... must be missing something here