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. ArrayList Delete Both Identical Strings?

ArrayList Delete Both Identical Strings?

Scheduled Pinned Locked Moved C#
helpquestion
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.
  • G Offline
    G Offline
    gman44
    wrote on last edited by
    #1

    I have an ArrayList containing data where BOTH identical strings need to be removed. program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm

    C S 2 Replies Last reply
    0
    • G gman44

      I have an ArrayList containing data where BOTH identical strings need to be removed. program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm

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

      If there's not a method to do this, sort them, iterate over them, and delete any that are the same as their neighbour.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      1 Reply Last reply
      0
      • G gman44

        I have an ArrayList containing data where BOTH identical strings need to be removed. program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm

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

        If you're sure there's only one duplicate you could simply call ArrayList.Remove twice.

        arrayList1.Remove("program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm");
        arrayList1.Remove("program files\softsoftware\program\help\help3.htm,9/22/2006 2:22 pm");


        "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
        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