Table of Contents

Interface IEnumerableTypeShape<TEnumerable, TElement>

Namespace
PolyType.Abstractions
Assembly
PolyType.dll

Provides a strongly typed shape model for a .NET type that is enumerable.

public interface IEnumerableTypeShape<TEnumerable, TElement> : ITypeShape<TEnumerable>, IEnumerableTypeShape, ITypeShape

Type Parameters

TEnumerable

The type of underlying enumerable.

TElement

The type of underlying element.

Inherited Members

Remarks

Typically covers all types implementing IEnumerable<T> or IEnumerable.

For non-generic collections, TElement is instantiated to object.

Properties

ElementType

Gets the shape of the underlying element type.

ITypeShape<TElement> ElementType { get; }

Property Value

ITypeShape<TElement>

Remarks

For non-generic IEnumerable this returns the shape for object.

Methods

GetAddElement()

Creates a setter delegate used for appending a TElement to a mutable collection.

Setter<TEnumerable, TElement> GetAddElement()

Returns

Setter<TEnumerable, TElement>

A setter delegate used for appending elements to a mutable collection.

Exceptions

InvalidOperationException

The collection is not Mutable.

GetEnumerableCollectionConstructor()

Creates a delegate for creating a collection from an enumerable.

EnumerableCollectionConstructor<TElement, TElement, TEnumerable> GetEnumerableCollectionConstructor()

Returns

EnumerableCollectionConstructor<TElement, TElement, TEnumerable>

A delegate constructing a collection from an enumerable of values.

Exceptions

InvalidOperationException

The collection is not Enumerable.

GetGetEnumerable()

Creates a delegate used for getting an IEnumerable<T> view of the enumerable.

Func<TEnumerable, IEnumerable<TElement>> GetGetEnumerable()

Returns

Func<TEnumerable, IEnumerable<TElement>>

A delegate accepting a TEnumerable and returning an IEnumerable<T> view of the instance.

GetMutableCollectionConstructor()

Creates a delegate for creating an empty, mutable collection.

MutableCollectionConstructor<TElement, TEnumerable> GetMutableCollectionConstructor()

Returns

MutableCollectionConstructor<TElement, TEnumerable>

A delegate wrapping a constructor that takes no elements.

Exceptions

InvalidOperationException

The collection is not Mutable.

GetSpanCollectionConstructor()

Creates a delegate for creating a collection from a span.

SpanCollectionConstructor<TElement, TElement, TEnumerable> GetSpanCollectionConstructor()

Returns

SpanCollectionConstructor<TElement, TElement, TEnumerable>

A delegate constructing a collection from a span of values.

Exceptions

InvalidOperationException

The collection is not Span.