/// <summary> /// Adds a variable to the watchlist. /// If it's already added, it only updates the value. /// </summary> /// <param name="name">variable name</param> /// <param name="value">reported value</param> /// <param name="global">is global</param> public void AddToWatchlist(string name, System.Object value, bool global = false) { var newVar = new VariableWatch(name); newVar.global = global; newVar.ReportValue(value); foreach (VariableWatch v in watched) { if (v.Equals(newVar)) { if (value != null) { v.ReportValue(value); } return; } } watched.Add(newVar); }
/// <summary> /// Adds a variable to the watchlist. /// If it's already added, it only updates the value. /// </summary> /// <param name="name">variable name</param> /// <param name="value">reported value</param> /// <param name="global">is global</param> public static void Add(string name, object value, bool global = false) { var newVar = new VariableWatch(name) { Global = global }; newVar.ReportValue(value); foreach (var v in Watched) { if (v.Equals(newVar)) { if (value != null) { v.ReportValue(value); } return; } } Watched.Add(newVar); }