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

GetAppender()

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

EnumerableAppender<TEnumerable, TElement> GetAppender()

Returns

EnumerableAppender<TEnumerable, TElement>

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

Exceptions

InvalidOperationException

The collection is not Mutable.

GetDefaultConstructor()

Creates a delegate for creating an empty, mutable collection.

MutableCollectionConstructor<TElement, TEnumerable> GetDefaultConstructor()

Returns

MutableCollectionConstructor<TElement, TEnumerable>

A delegate for creating an empty mutable collection.

Exceptions

InvalidOperationException

The collection is not Mutable.

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.

GetParameterizedConstructor()

Creates a delegate for creating a collection from a span.

ParameterizedCollectionConstructor<TElement, TElement, TEnumerable> GetParameterizedConstructor()

Returns

ParameterizedCollectionConstructor<TElement, TElement, TEnumerable>

A delegate constructing a collection from a span of values.

Exceptions

InvalidOperationException

The collection is not Parameterized.