R
Richard Brown
I have the following two classes...
public class classA {
private string text;
public string Text {
get { return text; }
set { MessageBox.Show(Text);
text = Text;
MessageBox.Show(Text);
}
}
}
public class classB {
void DoTest() {
classA varA;
varA = new classA();
MessageBox.Show(varA.Text);
varA.Text = "New Text";
MessageBox.Show(varA.Text);
}
}
When I call classB.DoTest, I get four blank message boxes! I can understand
the first one, with varA not being set yet, but the last three should all
have "New Text"! It seems that the string is not even getting 'inside' the
property set block.
public class classA {
private string text;
public string Text {
get { return text; }
set { MessageBox.Show(Text);
text = Text;
MessageBox.Show(Text);
}
}
}
public class classB {
void DoTest() {
classA varA;
varA = new classA();
MessageBox.Show(varA.Text);
varA.Text = "New Text";
MessageBox.Show(varA.Text);
}
}
When I call classB.DoTest, I get four blank message boxes! I can understand
the first one, with varA not being set yet, but the last three should all
have "New Text"! It seems that the string is not even getting 'inside' the
property set block.