Show / Hide Table of Contents

Class CollectionType

Provides specialized reflection methods for collection types.

Inheritance
object
CollectionType
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.Reflection
Assembly: DotNext.dll
Syntax
public static class CollectionType

Methods

View Source

GetItemType(Type, out Type?)

Obtains type of items in the collection type.

Declaration
public static Type? GetItemType(this Type collectionType, out Type? enumerableInterface)
Parameters
Type Name Description
Type collectionType

Any collection type implementing IEnumerable<T>.

Type enumerableInterface

The type IEnumerable<T> with actual generic argument.

Returns
Type Description
Type

Type of items in the collection; or null if collectionType is not a generic collection.

View Source

get_ImplementedCollection(Type)

Returns type of collection implemented by the given type.

Declaration
public static Type? get_ImplementedCollection(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
Type

The interface of the collection implemented by the given type; otherwise, null if collection interface is not implemented.

Remarks

The supported collection types are ICollection<T>, IReadOnlyCollection<T>.

See Also
ICollection<T>
IReadOnlyCollection<T>
View Source

get_IndexerGetter<T>()

Represents list item getter.

Declaration
public static Func<IList<T>, int, T> get_IndexerGetter<T>() where T : notnull
Returns
Type Description
Func<IList<T>, int, T>
Type Parameters
Name Description
T
View Source

get_IndexerSetter<T>()

Represents list item setter.

Declaration
public static Action<IList<T>, int, T> get_IndexerSetter<T>() where T : notnull
Returns
Type Description
Action<IList<T>, int, T>
Type Parameters
Name Description
T
View Source

get_Indexer<T>()

Represents read-only list item getter.

Declaration
public static Func<IReadOnlyList<T>, int, T> get_Indexer<T>() where T : notnull
Returns
Type Description
Func<IReadOnlyList<T>, int, T>
Type Parameters
Name Description
T
View Source

get_ItemType(Type)

Obtains type of items in the collection type.

Declaration
public static Type? get_ItemType(Type collectionType)
Parameters
Type Name Description
Type collectionType
Returns
Type Description
Type

Type of items in the collection; or null if collectionType is not a generic collection.

  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾