namespace WinFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public class class1 { public string? CON { get; set; } } private class1? test = null; private void button1_Click(object sender, EventArgs e) { if (this.test == null) { this.test = new class1(); this.test.CON = "2"; } } private void button2_Click(object sender, EventArgs e) { if (this.test == null) { MessageBox.Show("まだ初期化さrていません"); } else { var value = this.test.CON; MessageBox.Show(value); } } } }