Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Static Public Member Functions | List of all members
Loyc.Collections.LCExt Class Reference

Extension methods for Loyc Collection interfaces (such as IListSource{T}) and for Loyc Collection adapters (such as AsReadOnly{T}, which returns a CollectionAsReadOnly{T} adapter.) More...


Source files:

Remarks

Extension methods for Loyc Collection interfaces (such as IListSource{T}) and for Loyc Collection adapters (such as AsReadOnly{T}, which returns a CollectionAsReadOnly{T} adapter.)

The source code for adapter extension methods such as AsReadOnly() is now placed in the source file for each adapter class (e.g. CollectionAsReadOnly.cs) to make it easier to use parts of Loyc.Essentials rather than the entire library (other "decoupling" suggestions are welcome.)

Static Public Member Functions

static BufferedSequence< T > Buffered< T > (this IEnumerator< T > source)
 
static BufferedSequence< T > Buffered< T > (this IEnumerable< T > source)
 
static IListSource< T > Buffered< T > (this IListSource< T > source)
 
static BufferedSequence< T > Buffered< T > (this IList< T > source)
 
static IReadOnlyCollection< T > AsReadOnly< T > (this ICollection< T > c)
 Treats any ICollection{T} object to IReadOnlyCollection{T}. More...
 
static IListSource< T > AsListSource< T > (this IList< T > c)
 Adapter: treats any IList{T} object as IListSource{T}. More...
 
static IListSource< T > AsListSource< T > (this IListAndListSource< T > c)
 
static ListSlice< T > Slice< T > (this IList< T > list, int start, int length=int.MaxValue)
 
static ListSlice< T > Slice< T > (this IListAndListSource< T > list, int start, int length=int.MaxValue)
 
static IList< T > AsList< T > (this IListSource< T > c)
 Converts any IListSource{T} object to a read-only IList{T}. More...
 
static ListSourceAsSparse< T > AsSparse< T > (this IListSource< T > list)
 Treats a non-sparse list as a read-only sparse list with no empty spaces. More...
 
static ISparseListSource< T > AsSparse< T > (this ISparseListSource< T > list)
 Returns list itself. This overload exists to prevent you from accidentally wrapping a sparse list in ListSourceAsSparse{T}, which would block access to knowledge of any empty spaces in the list. More...
 
static NegList< T > NegView< T > (this IList< T > list, int zeroOffset)
 
static NegList< T > NegView< T > (this IListAndListSource< T > list, int zeroOffset)
 
static NegListSlice< T > Slice< T > (this INegListSource< T > list, int start, int count)
 
static NegListSource< T > NegView< T > (this IListSource< T > list, int zeroOffset)
 
static ReversedListSource< T > Reverse< T > (this IListSource< T > c)
 Returns a reversed view of a read-only list. More...
 
static SelectNegLists< T > NegLists< T > (this IList< T > source)
 
static SelectNegLists< T > NegLists< T > (this IListAndListSource< T > source)
 
static SelectNegListSources< T > NegLists< T > (this IListSource< T > source)
 
static ICollection< T > AsCollection< T > (this IReadOnlyCollection< T > c)
 Adapter: treats any IReadOnlyCollection{T} as a read-only ICollection{T}. More...
 
static IReadOnlyCollection
< TResult > 
UpCast< T, TResult > (this IReadOnlyCollection< T > source)
 
static IListSource< TResult > UpCast< T, TResult > (this IListSource< T > source)
 
static string Join (this System.Collections.IEnumerable list, string separator)
 
static IListSource< TResult > Select< T, TResult > (this IListSource< T > source, Func< T, TResult > selector)
 

Member Function Documentation

static ICollection<T> Loyc.Collections.LCExt.AsCollection< T > ( this IReadOnlyCollection< T >  c)
inlinestatic

Adapter: treats any IReadOnlyCollection{T} as a read-only ICollection{T}.

This method is named "AsCollection" and not "ToCollection" because, in contrast to methods like ToArray() and ToList(), it does not make a copy of the sequence, although it does create a new wrapper object.

static IList<T> Loyc.Collections.LCExt.AsList< T > ( this IListSource< T >  c)
inlinestatic

Converts any IListSource{T} object to a read-only IList{T}.

This method is named "AsList" and not "ToList" because because, in contrast to methods like ToArray(), it does not make a copy of the sequence, although it does create a new wrapper object if c does not implement IList{T}.

static IListSource<T> Loyc.Collections.LCExt.AsListSource< T > ( this IList< T >  c)
inlinestatic

Adapter: treats any IList{T} object as IListSource{T}.

This method is named "AsListSource" and not "ToListSource" because, in contrast to methods like ToArray() and ToList(), it does not make a copy of the sequence.

static IReadOnlyCollection<T> Loyc.Collections.LCExt.AsReadOnly< T > ( this ICollection< T >  c)
inlinestatic

Treats any ICollection{T} object to IReadOnlyCollection{T}.

This method is named "AsReadOnly" and not "ToReadOnly" because, in contrast to methods like ToArray(), and ToList() it does not make a copy of the sequence, although it does create a new wrapper object.

static ListSourceAsSparse<T> Loyc.Collections.LCExt.AsSparse< T > ( this IListSource< T >  list)
inlinestatic

Treats a non-sparse list as a read-only sparse list with no empty spaces.

static ISparseListSource<T> Loyc.Collections.LCExt.AsSparse< T > ( this ISparseListSource< T >  list)
inlinestatic

Returns list itself. This overload exists to prevent you from accidentally wrapping a sparse list in ListSourceAsSparse{T}, which would block access to knowledge of any empty spaces in the list.

static ReversedListSource<T> Loyc.Collections.LCExt.Reverse< T > ( this IListSource< T >  c)
inlinestatic

Returns a reversed view of a read-only list.

This was originally named ReverseView. Changed to Reverse to match Linq's Reverse(IEnumerable).