-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Description
I need serialization of generic types.
Let I have a generic type:
type T<'a>(a: 'a) =
member x.A = a
I want to serialize instances of this type T(10), T("abc") and would create a serializer type as follows:
let TSerializer<'a>() =
interface ISerializer<'a> with
member x.TypeId = "T"
member x.Serialize _ t -> ...
member x.Deserializer _ is -> ...
Now only non-generic serializers can be registered in a serializer library. But still it seems possible to do the following, if a serializer type has same order and number of type parameters as its target type:
lib.Register(typedefof<TSerializer<_>>)