DefaultConcreteTypeRepositoryRegister Method |
Registers the default type of the collection.
Namespace: MsgPack.SerializationAssembly: MsgPack (in MsgPack.dll) Version: 0.6.0
Syntaxpublic void Register(
Type abstractCollectionType,
Type defaultCollectionType
)
Public Sub Register (
abstractCollectionType As Type,
defaultCollectionType As Type
)
public:
void Register(
Type^ abstractCollectionType,
Type^ defaultCollectionType
)
member Register :
abstractCollectionType : Type *
defaultCollectionType : Type -> unit
Parameters
- abstractCollectionType
- Type: SystemType
Type of the abstract collection. - defaultCollectionType
- Type: SystemType
Default concrete type of the abstractCollectionType.
ExceptionsException | Condition |
---|
ArgumentNullException | abstractCollectionType is null.
Or defaultCollectionType is null.
|
ArgumentException | abstractCollectionType is not collection type.
Or defaultCollectionType is abstract class or interface.
Or defaultCollectionType is open generic type but abstractCollectionType is closed generic type.
Or defaultCollectionType is closed generic type but abstractCollectionType is open generic type.
Or defaultCollectionType does not have same arity for abstractCollectionType.
Or defaultCollectionType is not assignable to abstractCollectionType
or the constructed type from defaultCollectionType will not be assignable to the constructed type from abstractCollectionType.
|
Remarks
If you want to overwrite default type for collection interfaces, you can use this method.
Note that this method only supports collection interface, that is subtype of the
IEnumerable interface.
Note |
---|
If you register invalid type for defaultCollectionType, then runtime exception will be occurred.
For example, you register IEnumerableT of Char and String pair, but it will cause runtime error.
|
See Also