public virtual string GetElementNameFormat(NamedElement el) { string text = el.DefaultName; if (text == string.Empty) { text = el.GetType().Name; } return(text + "{0}"); }
public void SetFieldValue(NamedElement item, string fieldName, object value) { PropertyInfo property = item.GetType().GetProperty("Item"); if (property != null) { property.SetValue(item, value, new object[1] { fieldName }); } }
public void AddItem(NamedElement item) { ((IList)this.items).Add((object)item); StringEnumerator enumerator = this.fieldNames.GetEnumerator(); try { while (enumerator.MoveNext()) { string current = enumerator.Current; Hashtable hashtable = this.fieldsCache[current] as Hashtable; if (hashtable != null) { PropertyInfo property = item.GetType().GetProperty("Item"); if (property != null) { object value = property.GetValue(item, new object[1] { current }); if (value != null) { hashtable[value] = item; } } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }