Beispiel #1
0
        public static T TryPeek <T>(this ITryPop <T> c, T defaultValue)
        {
            bool isEmpty;
            T    value = c.TryPeek(out isEmpty);

            return(isEmpty ? defaultValue : value);
        }
Beispiel #2
0
        public static bool TryPeek <T>(this ITryPop <T> c, out T value)
        {
            bool isEmpty;

            value = c.TryPeek(out isEmpty);
            return(!isEmpty);
        }
Beispiel #3
0
        public static T Peek <T>(this ITryPop <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);
        }
Beispiel #4
0
        public static T TryPeek <T>(this ITryPop <T> c)
        {
            bool isEmpty;

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