コード例 #1
0
        /// <summary>
        /// Finds an object of the inputted name and casts to the inputted type K.
        /// First searches the ActiveObjects and then the ObjectsToAdd
        /// </summary>
        /// <typeparam name="K">The type we wish to return the found object as</typeparam>
        /// <param name="predicate">The predicate we will use to apply a condition for which we wish to find the object</param>
        /// <returns>Returns the object casted to K or null</returns>
        public K FindChild <K>(Predicate <T> predicate) where K : T
        {
            K obj = null;

            obj = ActiveObjects.Find(predicate) as K;

            if (obj != null)
            {
                return(obj);
            }

            obj = ObjectsToAdd.Find(predicate) as K;

            return(obj);
        }