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. Design and Architecture
  4. Handling text data retrieved from file

Handling text data retrieved from file

Scheduled Pinned Locked Moved Design and Architecture
helpquestioncsharptutoriallearning
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
    rsaint27
    wrote on last edited by
    #1

    Hello, I'm doing some free-time programming with learning objective (in c#), and one of my "projects" led me to separate data taken from a text file. Opening and retrieving data is no problem, I just put it into a ListArray<> of string element for now. But when I want to separate the data from that ListArray, the only solution I've come up with is as 'ugly' as this one: (some code here) foreach (string str in stream) { if (str.contains(some string)) { do something } else { if (str.contains(some other string)) { do other thing } else { (... even more if's) } } } I think there should be another way to do this, specially without so much "contains" operations that are time consuming. Can you give me some directions on how to break such items apart? I'm thinking this could also be used in other areas like socket communication. This feels like a very dumb question to me, but if I don't ask, I'll never learn. Thanks for any help you can give me.

    P 1 Reply Last reply
    0
    • R rsaint27

      Hello, I'm doing some free-time programming with learning objective (in c#), and one of my "projects" led me to separate data taken from a text file. Opening and retrieving data is no problem, I just put it into a ListArray<> of string element for now. But when I want to separate the data from that ListArray, the only solution I've come up with is as 'ugly' as this one: (some code here) foreach (string str in stream) { if (str.contains(some string)) { do something } else { if (str.contains(some other string)) { do other thing } else { (... even more if's) } } } I think there should be another way to do this, specially without so much "contains" operations that are time consuming. Can you give me some directions on how to break such items apart? I'm thinking this could also be used in other areas like socket communication. This feels like a very dumb question to me, but if I don't ask, I'll never learn. Thanks for any help you can give me.

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Have you come up with any good ideas?

      "I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon

      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