/// <summary> /// Gets the name of the item corresponding /// </summary> /// <param name="value">The item cast as an object.</param> /// <returns>The string name of the specified object, or null if the cast fails.</returns> public string GetNameOfObject(object value) { T item = Global.SafeCastTo <T>(value); if (item == null) { return(null); } return(GetName(item)); }
/// <summary> /// This copies any individual members of the list. If the item can be /// cloned, then it copies the cloned item. Otherwise it copies the regular item. /// This method can be overridden to handle special behavior in sub-classes. /// </summary> /// <param name="copy">The copy.</param> protected virtual void OnCopy(CopyList <T> copy) { copy.InnerList = new List <T>(); foreach (T item in InnerList) { ICloneable c = Global.SafeCastTo <ICloneable>(item); if (c != null) { T value = Global.SafeCastTo <T>(c.Clone()); copy.Add(value); } else { copy.Add(item); } } }
/// <summary> /// Gets the name of the item corresponding. /// </summary> /// <param name="value">The item cast as an object.</param> /// <returns>The string name of the specified object, or null if the cast fails.</returns> public string GetNameOfObject(object value) { T item = Global.SafeCastTo <T>(value); return(item == null ? null : GetName(item)); }