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. Can one XML file hold more than one C# object?

Can one XML file hold more than one C# object?

Scheduled Pinned Locked Moved C#
questioncsharpxml
4 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.
  • T Offline
    T Offline
    TrooperIronMan
    wrote on last edited by
    #1

    Can one XML file hold more than one C# object? Say 2 or 3 ArrayLists? I have more few questions regarding this, but this is basic question to make sense to others I have...

    L 1 Reply Last reply
    0
    • T TrooperIronMan

      Can one XML file hold more than one C# object? Say 2 or 3 ArrayLists? I have more few questions regarding this, but this is basic question to make sense to others I have...

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      If you mean using Serialization, Yes.

      led mike

      T 1 Reply Last reply
      0
      • L led mike

        If you mean using Serialization, Yes.

        led mike

        T Offline
        T Offline
        TrooperIronMan
        wrote on last edited by
        #3

        OK on simple example, I know how to do it with one object say something like this is done: XmlSerializer ser = new XmlSerializer(typeof(ArrayList), new Type[] { typeof(SomeClass) }); XmlTextWriter writ = new XmlTextWriter("List.xml", System.Text.Encoding.UTF8); ser.Serialize(writ, SomeList); writ.Close(); Can you show me example, loading for example two ArrayLists each hold diferent type of data...

        T 1 Reply Last reply
        0
        • T TrooperIronMan

          OK on simple example, I know how to do it with one object say something like this is done: XmlSerializer ser = new XmlSerializer(typeof(ArrayList), new Type[] { typeof(SomeClass) }); XmlTextWriter writ = new XmlTextWriter("List.xml", System.Text.Encoding.UTF8); ser.Serialize(writ, SomeList); writ.Close(); Can you show me example, loading for example two ArrayLists each hold diferent type of data...

          T Offline
          T Offline
          TrooperIronMan
          wrote on last edited by
          #4

          Any idea, i figured out i can make one more arraylist and put anything I want in XML in it... and done... but is there more elegant solution?

          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