Пример #1
0
        public static T TryPop <T>(this IPop <T> c, T defaultValue)
        {
            bool isEmpty;
            T    value = c.TryPop(out isEmpty);

            return(isEmpty ? defaultValue : value);
        }
Пример #2
0
        public static bool TryPop <T>(this IPop <T> c, out T value)
        {
            bool isEmpty;

            value = c.TryPop(out isEmpty);
            return(!isEmpty);
        }
Пример #3
0
        public static T Pop <T>(this IPop <T> c)
        {
            bool isEmpty;
            T    next = c.TryPop(out isEmpty);

            if (isEmpty)
            {
                throw new InvalidOperationException("The {0} is empty".Localized(c.GetType().Name));
            }
            return(next);
        }
Пример #4
0
        public static T Pop <T>(this IPop <T> c)
        {
            bool isEmpty;
            T    next = c.TryPop(out isEmpty);

            if (isEmpty)
            {
                throw new EmptySequenceException("The {0} is empty".Localized(MemoizedTypeName.Get(c.GetType())));
            }
            return(next);
        }
Пример #5
0
        public static T TryPop <T>(this IPop <T> c)
        {
            bool isEmpty;

            return(c.TryPop(out isEmpty));
        }