Ejemplo n.º 1
0
        /// <summary>
        /// Returns whether an object satisfying the inputted predicate exists within the container.
        /// First serches the ActiveObjects and then the ObjectsToAdd.
        /// </summary>
        /// <param name="predicate">The predicate the object must satisfy</param>
        /// <returns>True if such an object exists and false if not</returns>
        public bool Exists(Predicate <T> predicate)
        {
            // Check our active objects for a valid object
            if (ActiveObjects.Exists(predicate))
            {
                // Return true if one exists
                return(true);
            }

            // Check our objects to add for a valid object
            if (ObjectsToAdd.Exists(predicate))
            {
                // Return true if one exists
                return(true);
            }

            // Otherwise no such object exists so return false
            return(false);
        }