public T Deserialize<T>(
byte[] rawData,
int offset,
params Type[]? expectedCustomTypes
)
Public Function Deserialize(Of T) (
rawData As Byte(),
offset As Integer,
ParamArray expectedCustomTypes As Type()
) As T
public:
generic<typename T>
T Deserialize(
array<unsigned char>^ rawData,
int offset,
... array<Type^>^ expectedCustomTypes
)
member Deserialize :
rawData : byte[] *
offset : int *
expectedCustomTypes : Type[] -> 'T
expectedCustomTypes must be specified if SafeMode is enabled in Options and rawData contains types encoded by their names. Natively supported types are not needed to be included unless the original object was serialized with the ForceRecursiveSerializationOfSupportedTypes option enabled.
T is allowed to be an interface or abstract type but if it's different from the actual type of the result, then the actual type also might needed to be included in expectedCustomTypes.
You can specify expectedCustomTypes even if SafeMode is not enabled in Options as it may improve the performance of type resolving and can help avoiding possible ambiguities if types were not serialized with full assembly identity (e.g. if OmitAssemblyQualifiedNames was enabled on serialization).
If a type in expectedCustomTypes has a different assembly identity in the deserialization stream, and it is not indicated by a TypeForwardedFromAttribute declared on the type, then you should set the Binder property to a ForwardedTypesSerializationBinder instance to specify the expected types.
For arrays it is enough to specify the element type and for generic types you can specify the natively not supported generic type definition and generic type arguments separately. If expectedCustomTypes contains constructed generic types, then the generic type definition and the type arguments will be treated as expected types in any combination.