Reputation: 894
I am in need of serializing a certain amount of data and deserialize it in a second time, all in an XML format.
At the moment I am using the Type.FullName information to avoid ambiguity and get through the deserialization process correctly.
I am, however, wondering how safe my approach is. For instance, when I look at the FullName of a list of strings, I get
"System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"
My question is, how likely is it that this FullName will change in the future? Should I limit myself as much as possible to the serialization of simpler objects to avoid trouble?
Best regards, Andrea
Upvotes: 1
Views: 297
Reputation: 87318
It's possible that it will change in the future - since it already changed once from .NET 2.0 (mscorlib, Version=2.0.0.0, Culture...) to 4.0. You may want to consider doing some processing on the type name (e.g., converting List`1[[something]] to List) prior to serializing the data, and doing the reverse processing (using type information from the current mscorlib version) when deserializing the data.
Upvotes: 2