Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | List of all members
Loyc.Collections.IBRange< out out T > Interface Template Reference

A bidirectional range. Allows you to read or remove the first or last element in a range. More...


Source file:
Inheritance diagram for Loyc.Collections.IBRange< out out T >:
Loyc.Collections.IFRange< T >

Remarks

A bidirectional range. Allows you to read or remove the first or last element in a range.

The bidirectional range interface is useful for supporting data structures such as doubly-linked lists that have a front and a back but no efficient access to the middle.

Please see IFRange<T> for general documentation about ranges.

Properties

Last [get]
 Returns the value of the last item in the range. More...
 
- Properties inherited from Loyc.Collections.IFRange< T >
First [get]
 Returns the first value in the range, without popping it. More...
 

Public Member Functions

PopLast (out bool fail)
 Removes the last item from the range and returns it. More...
 
- Public Member Functions inherited from Loyc.Collections.IFRange< T >
PopFirst (out bool fail)
 Removes the first item from the range and returns it. More...
 

Member Function Documentation

T Loyc.Collections.IBRange< out out T >.PopLast ( out bool  fail)

Removes the last item from the range and returns it.

Parameters
failReceives the current value of IsEmpty.
Returns
The first item of the range, or default(T) if IsEmpty.

The remarks of IFRange<T>.PopFirst apply to this method.

Referenced by Loyc.Collections.RangeExt.Skip< R, T >().

Property Documentation

T Loyc.Collections.IBRange< out out T >.Last
get

Returns the value of the last item in the range.

Exceptions
EmptySequenceExceptionThe sequence is empty.

A reasonable default implementation:

T Last { get { return Range.PopLast(Clone()); } }