Show / Hide Table of Contents

Class CollectionType

Provides specialized reflection methods for collection types.

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

Methods

| Edit this page View Source

GetImplementedCollection(Type)

Returns type of collection implemented by the given type.

Declaration
public static Type? GetImplementedCollection(this Type type)
Parameters
Type Name Description
Type type

The type that implements the one of the supported collection types.

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>
| Edit this page View Source

GetItemType(Type)

Obtains type of items in the collection type.

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

Any collection type implementing IEnumerable<T>.

Returns
Type Description
Type

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

| Edit this page 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.

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