public static T TryPeek <T>(this ITryPop <T> c, T defaultValue) { bool isEmpty; T value = c.TryPeek(out isEmpty); return(isEmpty ? defaultValue : value); }
public static bool TryPeek <T>(this ITryPop <T> c, out T value) { bool isEmpty; value = c.TryPeek(out isEmpty); return(!isEmpty); }
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); }
public static T TryPeek <T>(this ITryPop <T> c) { bool isEmpty; return(c.TryPeek(out isEmpty)); }