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

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 an 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.

GetDefaultConstructor()

Creates a delegate wrapping a parameterless constructor of a mutable collection.

Func<TEnumerable> GetDefaultConstructor()

Returns

Func<TEnumerable>

A delegate wrapping a default constructor.

Exceptions

InvalidOperationException

The collection is not Mutable.

GetEnumerableConstructor()

Creates a constructor delegate for creating a collection from an enumerable.

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

Returns

Func<IEnumerable<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 a 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.

GetSpanConstructor()

Creates a constructor delegate for creating a collection from a span.

SpanConstructor<TElement, TEnumerable> GetSpanConstructor()

Returns

SpanConstructor<TElement, TEnumerable>

A delegate constructing a collection from a span of values.

Exceptions

InvalidOperationException

The collection is not Span.