Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Serialization Question

Serialization Question

Scheduled Pinned Locked Moved .NET (Core and Framework)
questionhelpregexjsonlearning
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MikeMarq
    wrote on last edited by
    #1

    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

    H G G 3 Replies Last reply
    0
    • M MikeMarq

      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

      H Offline
      H Offline
      Hesham Yassin
      wrote on last edited by
      #2

      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!

      1 Reply Last reply
      0
      • M MikeMarq

        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

        G Offline
        G Offline
        Giorgi Dalakishvili
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • M MikeMarq

          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

          G Offline
          G Offline
          Gideon Engelberth
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups