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. Best way of generating a lookup table

Best way of generating a lookup table

Scheduled Pinned Locked Moved C#
xmltutorialquestion
3 Posts 3 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
    mail572352
    wrote on last edited by
    #1

    Hi, I have to store a list as an external file of part codes and corresponding descriptions for later retrieval by other applications. What's the best way of doing it? Each entry in the list consists of two strings, a part code and a description. I could just write to a text file and read from it again or should I use XML? Anyone have any ideas or examples of how to implement such code? Thanks :)

    S T 2 Replies Last reply
    0
    • M mail572352

      Hi, I have to store a list as an external file of part codes and corresponding descriptions for later retrieval by other applications. What's the best way of doing it? Each entry in the list consists of two strings, a part code and a description. I could just write to a text file and read from it again or should I use XML? Anyone have any ideas or examples of how to implement such code? Thanks :)

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      Personally, I always favor XML over a plain text file. First, you can define an additional schema that allows you and other applications to easily validate whether the XML file contains data in a valid format. Second, you can use XPath to easily lookup the description for a part code. Finally, you are probably able to use the XmlSerializer class to easily create the Xml file in your application; depends on the way the you implemented the list to be stored in your application.?


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      1 Reply Last reply
      0
      • M mail572352

        Hi, I have to store a list as an external file of part codes and corresponding descriptions for later retrieval by other applications. What's the best way of doing it? Each entry in the list consists of two strings, a part code and a description. I could just write to a text file and read from it again or should I use XML? Anyone have any ideas or examples of how to implement such code? Thanks :)

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

        Use XmlTextWriter. For part key pairs, try this:

        XmlTextWriter 
        

        Evil cannot be conquered in the world... It can only be resisted within oneself.

        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