示例#1
0
        public static T Peek <T>(this IPop <T> c)
        {
            bool isEmpty;
            T    next = c.TryPeek(out isEmpty);

            if (isEmpty)
            {
                throw new InvalidOperationException("The {0} is empty".Localized(c.GetType().Name));
            }
            return(next);
        }
示例#2
0
        public static T Pop <T>(this IPop <T> c)
        {
            bool isEmpty;
            T    next = c.TryPop(out isEmpty);

            if (isEmpty)
            {
                throw new InvalidOperationException(string.Format("The {0} is empty", c.GetType().Name));
            }
            return(next);
        }
        public static T Peek <T>(this IPop <T> c)
        {
            bool isEmpty;
            T    next = c.TryPeek(out isEmpty);

            if (isEmpty)
            {
                throw new EmptySequenceException("The {0} is empty".Localized(MemoizedTypeName.Get(c.GetType())));
            }
            return(next);
        }