/// <summary> /// Determine if the locator contains an object for the given key. /// </summary> /// <param name="key">The key to check.</param> /// <returns> /// true if the locator contains an object for the key; returns /// false otherwise. /// </returns> public override bool Contains(object key) { Guard.ArgumentNotNull(key, "key"); if (references.ContainsKey(key)) { return(true); } if (ParentLocator != null) { return(ParentLocator.Contains(key)); } return(false); }
/// <summary> /// See <see cref="IReadableLocator.Contains(object, SearchMode)"/> for more information. /// </summary> public override bool Contains(object key, SearchMode options) { if (key == null) { throw new ArgumentNullException("key"); } if (!Enum.IsDefined(typeof(SearchMode), options)) { throw new ArgumentException(Properties.Resources.InvalidEnumerationValue, "options"); } if (references.ContainsKey(key)) { return(true); } if (options == SearchMode.Up && ParentLocator != null) { return(ParentLocator.Contains(key, options)); } return(false); }