Generic Serializer for C#