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. Converting and ArrayList into a string

Converting and ArrayList into a string

Scheduled Pinned Locked Moved C#
data-structureshelp
7 Posts 4 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
    Rizwan Rathore
    wrote on last edited by
    #1

    Hi I want to convert an ArrayList into a single string (not an array of strings) Looking forward for help Regards,

    L W C 3 Replies Last reply
    0
    • R Rizwan Rathore

      Hi I want to convert an ArrayList into a single string (not an array of strings) Looking forward for help Regards,

      L Offline
      L Offline
      Larantz
      wrote on last edited by
      #2

      string myString;

      foreach(object obj in myArrayList)
      myString += obj.ToString();

      You could also add a separator between each item so it's easier to separate if you need to later. For instance "mystring += obj.ToString() + ":"; Then you can separate on ":". -Larantz-

      1 Reply Last reply
      0
      • R Rizwan Rathore

        Hi I want to convert an ArrayList into a single string (not an array of strings) Looking forward for help Regards,

        W Offline
        W Offline
        Wjousts
        wrote on last edited by
        #3

        What is wrong with the answers that Christian Graus and I have already given you?

        C 1 Reply Last reply
        0
        • R Rizwan Rathore

          Hi I want to convert an ArrayList into a single string (not an array of strings) Looking forward for help Regards,

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Rizwan Rathore wrote:

          Looking forward for help

          If, when you've been given the correct answer, you don't understand it, you should respond and ask for more info. Given how trivial the answer is, you should probably post a code sample of what you're trying to do, so we can work out what is confusing you. Christian Graus - Microsoft MVP - C++

          R 1 Reply Last reply
          0
          • W Wjousts

            What is wrong with the answers that Christian Graus and I have already given you?

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Yeah, I saw this and wondered why my answer had disappeared :-) Christian Graus - Microsoft MVP - C++

            1 Reply Last reply
            0
            • C Christian Graus

              Rizwan Rathore wrote:

              Looking forward for help

              If, when you've been given the correct answer, you don't understand it, you should respond and ask for more info. Given how trivial the answer is, you should probably post a code sample of what you're trying to do, so we can work out what is confusing you. Christian Graus - Microsoft MVP - C++

              R Offline
              R Offline
              Rizwan Rathore
              wrote on last edited by
              #6

              sorry sir, the answer was rite but i was not able to find this thread b4 :( coz i have just started using this question answer thing here.... so after trying a little i thought its easy to repost it... but now i have understand it and i ll take care about it Regards,

              C 1 Reply Last reply
              0
              • R Rizwan Rathore

                sorry sir, the answer was rite but i was not able to find this thread b4 :( coz i have just started using this question answer thing here.... so after trying a little i thought its easy to repost it... but now i have understand it and i ll take care about it Regards,

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                That's fine - if you configure your setting to have a valid email address, you'll get an email with a link when people reply to you. Christian Graus - Microsoft MVP - C++

                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