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