How do I determine if the value of a string variable changed in C#?
问题 I have something to do under a button click (add values to listbox) only if a particular string changes from its previous value. How do I manage this? Below is a sample of my code: private void button6_Click(object sender, EventArgs e) { string x = //some varying value I get from other parts of my program listBox1.Items.Clear(); listBox1.Items.Add(x + /*other things*/); } I can at times have same value for string x from previous value when clicking button6. In such cases I don't want listBox1