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. C#
  4. Non strict serialization/deserialization

Non strict serialization/deserialization

Scheduled Pinned Locked Moved C#
csharpwcfcomjsonquestion
2 Posts 2 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.
  • R Offline
    R Offline
    Roger Alsing 0
    wrote on last edited by
    #1

    Is there any kind of serializer in .net that can be used to load and save object graphs w/o barfing if unexpected/old elements exist in the serialized data? I simply want to ignore field/property names that no longer exist in the serialized classes. such field should simply be set to their default values. XmlSerializer won't cut it since it only handles hierarchies and real graphs. SoapFormatter seems like it always crash if unexpected elements are found. I do know I can implement ISerializable but Im trying to avoid that, I want it to be easy to plug in new elements in the save file in this use case. I'm hoping there might be some nifty stuff in WCF for this, or that it might be possible to handle this with the soapformatter. any ideas?

    Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com

    L 1 Reply Last reply
    0
    • R Roger Alsing 0

      Is there any kind of serializer in .net that can be used to load and save object graphs w/o barfing if unexpected/old elements exist in the serialized data? I simply want to ignore field/property names that no longer exist in the serialized classes. such field should simply be set to their default values. XmlSerializer won't cut it since it only handles hierarchies and real graphs. SoapFormatter seems like it always crash if unexpected elements are found. I do know I can implement ISerializable but Im trying to avoid that, I want it to be easy to plug in new elements in the save file in this use case. I'm hoping there might be some nifty stuff in WCF for this, or that it might be possible to handle this with the soapformatter. any ideas?

      Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      I assume you are using the BinaryFormatter. Wont ISurrogateSelector help?

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 3 out now

      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