Serialization Question
-
I'm trying to save a file by putting all the file information in a class and serialize it then deserialize that file in another program. When I open the file in the same program that created it it's fine but when I try to open it in the other program with the exact same code it gives me an error because it appears that the serializer includes assembly info and those of course don't match in different programs. So my question how can I get around this problem or is there anything equivelent to serialization that won't give me these problems? thanks, Mike
-
I'm trying to save a file by putting all the file information in a class and serialize it then deserialize that file in another program. When I open the file in the same program that created it it's fine but when I try to open it in the other program with the exact same code it gives me an error because it appears that the serializer includes assembly info and those of course don't match in different programs. So my question how can I get around this problem or is there anything equivelent to serialization that won't give me these problems? thanks, Mike
The problem is in the second program. Try to deserialize your class in an object variable. if it's working then the problem might be in the way you defined the class structure in the second program. if the solution of the "object variable" didn't work then the problem might be in the code! wish this help!
-
I'm trying to save a file by putting all the file information in a class and serialize it then deserialize that file in another program. When I open the file in the same program that created it it's fine but when I try to open it in the other program with the exact same code it gives me an error because it appears that the serializer includes assembly info and those of course don't match in different programs. So my question how can I get around this problem or is there anything equivelent to serialization that won't give me these problems? thanks, Mike
Here you are: Advanced Binary Serialization: Deserializing an Object Into a Different Type Than the One It was Serialized Into[^]
Giorgi Dalakishvili #region signature My Articles / My Latest Article[^] / My blog[^] #endregion
-
I'm trying to save a file by putting all the file information in a class and serialize it then deserialize that file in another program. When I open the file in the same program that created it it's fine but when I try to open it in the other program with the exact same code it gives me an error because it appears that the serializer includes assembly info and those of course don't match in different programs. So my question how can I get around this problem or is there anything equivelent to serialization that won't give me these problems? thanks, Mike
Since it sounds like you have control over both applications, the simplest solution would be to just pull that class out into a common library and have both programs reference that shared library. Then the class would be from the same assembly in both applications.