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. XML / XSL
  4. Deserializing of List Array appends instead of overwrite

Deserializing of List Array appends instead of overwrite

Scheduled Pinned Locked Moved XML / XSL
questiondata-structuresxmljsonhelp
2 Posts 2 Posters 34 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.
  • W Offline
    W Offline
    Wild Thing
    wrote on last edited by
    #1

    Hi, I am using a list of a class. Serialization works fine, but Deserialization leads to creating new lists, which are appended to main list. I.e. if Deflists in AllKeyList contains 5 KeyDefinition Classes, after Deserialization there are 10. How can I force overriding? Thx adv for your help. What I'm doing:

            FileStream fs = new FileStream(sFile, FileMode.Open);
            var x = new System.Xml.Serialization.XmlSerializer(Setup.GetType());
    
            var settings = new XmlReaderSettings { CheckCharacters = false, };
            try
            {
                Setup = (DataSettings)x.Deserialize(fs);
                Console.WriteLine("XML Read {0} erfolgreich", sFile);
    

    Data structure:

    public class KeyDefinition
    {
        public string Name { get; set; }
        public string KeyType { get; set; }
        public List KeyDef { get; set; }
        ....
    }
    
    public class AllKeyList
    {
        public List DefLists { get; set; }
        ...
    }
    
    K 1 Reply Last reply
    0
    • W Wild Thing

      Hi, I am using a list of a class. Serialization works fine, but Deserialization leads to creating new lists, which are appended to main list. I.e. if Deflists in AllKeyList contains 5 KeyDefinition Classes, after Deserialization there are 10. How can I force overriding? Thx adv for your help. What I'm doing:

              FileStream fs = new FileStream(sFile, FileMode.Open);
              var x = new System.Xml.Serialization.XmlSerializer(Setup.GetType());
      
              var settings = new XmlReaderSettings { CheckCharacters = false, };
              try
              {
                  Setup = (DataSettings)x.Deserialize(fs);
                  Console.WriteLine("XML Read {0} erfolgreich", sFile);
      

      Data structure:

      public class KeyDefinition
      {
          public string Name { get; set; }
          public string KeyType { get; set; }
          public List KeyDef { get; set; }
          ....
      }
      
      public class AllKeyList
      {
          public List DefLists { get; set; }
          ...
      }
      
      K Offline
      K Offline
      kdbueno
      wrote on last edited by
      #2

      array list, are working in methods, of acceptance, but not equivalent static and kinetic algorithmics works well with ibm datastage, for instance, nor ibm infosphere.

      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