I have a class as follows:
class TestSomeData
{
public string someString;
public void CheckSomeStuff()
{
foreach(string x in someList)
{
someString = x;
}
}
}
What i want to do is this:
TestSomeData test = new TestSomeData;
test.CheckSomeStuff();
label1.Content = test.someString;
So if x is 1,2,3,4,5 out of someList in CheckSomeStuff, i need the label1.Content to reflect that, but from a different class. how do i do that?
A class can inform other classes of changes made to it by declaring events
You could also make the event static. This would allow a listener to listen to changes of any instance of this class.