How to update the whole list when just one element is modified outside in a class in c#? -
class foo { public list<object> mylist; public int num; public string name; public bool isit; public foo() { mylist = new list<object>(); mylist.add(num); mylist.add(name); mylist.add(isit); } } class program { static void main(string[] args) { foo = new foo(); my.isit = true; my.mylist[0] = 5; my.mylist[1] = "hello"; console.writeline("" + my.mylist[2]); => returns false instead of true console.readline(); } }
assuming list have item @ index 2:
private bool _isit; public list<object> mylist; public bool isit{ get{return _isit;} set{ _isit = value; mylist[2] = value; } }
Comments
Post a Comment