private void button2_Click(object sender, EventArgs e) { string s = textBox1.Text; TLocation obj = JsonConvert.DeserializeObject <TLocation>(s); button2.Text = obj.Name; }
private void button1_Click(object sender, EventArgs e) { TLocation obj = new TLocation() { X = 100, Y = 200, Name = "TC" }; string s = JsonConvert.SerializeObject(obj); textBox1.Text = s; // {"X":100,"Y":200,"Name":"TC"} }