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. Deserializing an object into another namespace.

Deserializing an object into another namespace.

Scheduled Pinned Locked Moved C#
helpcomtoolsquestion
5 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.
  • S Offline
    S Offline
    Syed Mehroz Alam
    wrote on last edited by
    #1

    Is it possible to deserialize an object that was previously serialzed under different namespace. Let me try to explain this using some code:

    namespace OldNamespace
    {
    [Serializable]
    public class Class1
    {
    .....
    }
    }

    Now I have moved the class to a different namespace.

    namespace NewNamespace
    {
    [Serializable]
    public class Class1
    {
    .....
    }
    }

    The problem is that now I can't deserialize objects that were previously serialized using old code. Is their a way out. Here's the error I get: Unable to load type OldNamespace.Class1 required for deserialization. Thanks, Syed Mehroz Alam

    My Articles

    G 1 Reply Last reply
    0
    • S Syed Mehroz Alam

      Is it possible to deserialize an object that was previously serialzed under different namespace. Let me try to explain this using some code:

      namespace OldNamespace
      {
      [Serializable]
      public class Class1
      {
      .....
      }
      }

      Now I have moved the class to a different namespace.

      namespace NewNamespace
      {
      [Serializable]
      public class Class1
      {
      .....
      }
      }

      The problem is that now I can't deserialize objects that were previously serialized using old code. Is their a way out. Here's the error I get: Unable to load type OldNamespace.Class1 required for deserialization. Thanks, Syed Mehroz Alam

      My Articles

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

      This might help: Advanced Binary Serialization: Deserializing an Object Into a Different Type Than the One It was Serialized Into[^]

      Giorgi Dalakishvili #region signature my articles #endregion

      S 2 Replies Last reply
      0
      • G Giorgi Dalakishvili

        This might help: Advanced Binary Serialization: Deserializing an Object Into a Different Type Than the One It was Serialized Into[^]

        Giorgi Dalakishvili #region signature my articles #endregion

        S Offline
        S Offline
        Syed Mehroz Alam
        wrote on last edited by
        #3

        Thanks for a very quick reply Giorgi. Let me go through it and write back to you if it works for me.

        My Articles

        1 Reply Last reply
        0
        • G Giorgi Dalakishvili

          This might help: Advanced Binary Serialization: Deserializing an Object Into a Different Type Than the One It was Serialized Into[^]

          Giorgi Dalakishvili #region signature my articles #endregion

          S Offline
          S Offline
          Syed Mehroz Alam
          wrote on last edited by
          #4

          Wonderful :-D. It worked!! Thanks again. Syed Mehroz Alam

          My Articles

          G 1 Reply Last reply
          0
          • S Syed Mehroz Alam

            Wonderful :-D. It worked!! Thanks again. Syed Mehroz Alam

            My Articles

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

            Glad to help you :)

            Giorgi Dalakishvili #region signature my articles #endregion

            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