I am trying to serialize a generic class. I will store this Serialization to disk. When looking over the MSDN it said this.
Binary serialization preserves type fidelity, which is useful for preserving the state of an object between different invocations of an application.
What does Type Fidelity mean? Will this preserve the type of object which is saved? Is there a "better" way of achieving what I want to do than serializing the object and saving it to disk?
public class foo<T>
{
public T coolProperty {get; set;}
}
Binary serialization includes the complete state of the object, so that when you deserialize (such as in another invocation of the same application) you get an exact copy back. So yes, it will preserve the type. XML serialization includes only the public properties of the object, and is useful for passing the object data between different platforms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With