/// <summary> /// Constructor /// </summary> /// <param name="weakSetStore">The WeakSetInstance internal storage</param> public WeakSetEntriesDebugView(ConditionalWeakTable <ObjectInstance, object> weakSetStore) { this.weakSetStore = weakSetStore; this.keys = weakSetStore.GetKeys(); this.entriesCount = this.keys.Count(); }
/// <summary> /// Converts WeakMapInstance to its string representation /// </summary> /// <param name="sb">StringBuilder to add strings</param> /// <param name="weakMapStore">Internal storage of a WeakMapInstance</param> public static void WeakMapRepresentation(StringBuilder sb, ConditionalWeakTable <ObjectInstance, object> weakMapStore) { bool comma = false; IEnumerable <ObjectInstance> keys = weakMapStore.GetKeys(); foreach (ObjectInstance key in keys) { object value; if (weakMapStore.TryGetValue(key, out value)) { if (comma) { sb.Append(", "); } sb.AppendFormat("{0} => {1}", DebuggerDisplayHelper.ShortStringRepresentation(key), DebuggerDisplayHelper.ShortStringRepresentation(value)); comma = true; } } }