/// <summary> /// Returns an element if it exists under that name, or raise an exception. /// </summary> public T GetByName(String name, bool mustExcept = true) { T item = namedItems.OptGetItem(name); if (item != null) { return(item); } if (mustExcept) { throw new BMException("Name '{0}' not found for type '{1}'.", name, typeof(T).FullName); } return(null); }