Click or drag to resize
AlgorithmsUntypedT Method (ICollectionT)
Given a generic ICollection<T> interface, wrap a non-generic (untyped) ICollection interface around it. The non-generic interface will contain the same objects as the underlying generic collection, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public static ICollection Untyped<T>(
	ICollection<T> typedCollection
)

Parameters

typedCollection
Type: System.Collections.GenericICollectionT
A typed collection to wrap.

Type Parameters

T
The item type of the underlying collection.

Return Value

Type: ICollection
A non-generic ICollection wrapper around typedCollection. If typedCollection is null, then null is returned.
Remarks
Many generic collections already implement the non-generic interfaces directly. This method will first attempt to simply cast typedCollection to ICollection. If that succeeds, it is returned; if it fails, then a wrapper object is created.
See Also