/// <summary> /// Retrieves the display text for the given list item. /// </summary> /// <param name="value">The list item for which to retrieve display text.</param> /// <returns>he display text for <paramref name="value"/>.</returns> protected override string GetDisplayText(object value) { EditableKeyValuePair <TKey, TValue> pair = value as EditableKeyValuePair <TKey, TValue>; if (pair != null) { return(string.Format(CultureInfo.CurrentCulture, "{0}={1}", pair.Key, pair.Value)); } else { return(base.GetDisplayText(value)); } }
/// <summary> /// Gets an array of objects containing the specified collection. /// </summary> /// <param name="editValue">The collection to edit.</param> /// <returns>An array containing the collection objects, or an empty object array if the specified collection does not inherit from ICollection.</returns> protected override object[] GetItems(object editValue) { if (editValue == null) { return(new object[0]); } Dictionary <TKey, TValue> dictionary = editValue as Dictionary <TKey, TValue>; if (dictionary == null) { throw new ArgumentNullException("editValue"); } object[] objArray = new object[dictionary.Count]; int num = 0; foreach (KeyValuePair <TKey, TValue> entry in dictionary) { EditableKeyValuePair <TKey, TValue> entry2 = new EditableKeyValuePair <TKey, TValue>(entry.Key, entry.Value, this.m_EditorAttribute); objArray[num++] = entry2; } return(objArray); }