Info
画面にテキストを表示するグラフィック コントロール クラスを作成しています。テキストはオブジェクトの文字列です。Info
クラスのインスタンス内からそのオブジェクトの最新の値を取得できるようにしたいと考えています。
class Info
{
public string Text;
}
void Program()
{
ClassA obj = new ClassA();
obj.name = "Instance of ClassA";
Info wind1 = new Info();
wind1.Text = obj.name; // this just copies current value, but should be a reference or something
/* obj.name value changes several times before it's time to display it again */
// Info window drawing method
foreach (var item in Windows) // Windows is List<Info>
Draw(item.Text); // this doesn't get the latest value
}
描画セクション内から最新の文字列値を取得できるようにするには、コードをどのように変更すればよいですか?