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. comparing two arrays

comparing two arrays

Scheduled Pinned Locked Moved C#
csharpdata-structuresquestion
5 Posts 5 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
    rameshdontagani
    wrote on last edited by
    #1

    hi, i have two array lists.. first arraylist consists of 1,2,4,6,8; second arraylist consists of 2,6,9,8 now i want to display the matched values from two arraylists and i need the values of second arraylist which are not in first arraylist.. how can i do this in c#

    J S G 3 Replies Last reply
    0
    • R rameshdontagani

      hi, i have two array lists.. first arraylist consists of 1,2,4,6,8; second arraylist consists of 2,6,9,8 now i want to display the matched values from two arraylists and i need the values of second arraylist which are not in first arraylist.. how can i do this in c#

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      If this is homework: Give it a try yourself, come back with specific coding problems and someone will help you. We will not however do your work for you. If this is paid work: You should not be employed as a programmer.

      1 Reply Last reply
      0
      • R rameshdontagani

        hi, i have two array lists.. first arraylist consists of 1,2,4,6,8; second arraylist consists of 2,6,9,8 now i want to display the matched values from two arraylists and i need the values of second arraylist which are not in first arraylist.. how can i do this in c#

        S Offline
        S Offline
        Skippums
        wrote on last edited by
        #3

        Easily... Take Jamie's advice. Post some code that illustrates you can put forth some effort in finding the solution yourself. Until you post code that appears to be close to working (or that we feel was typed in a good-faith effort to solve the problem), and with specific problems/questions, we will not help. -Jeff

        1 Reply Last reply
        0
        • R rameshdontagani

          hi, i have two array lists.. first arraylist consists of 1,2,4,6,8; second arraylist consists of 2,6,9,8 now i want to display the matched values from two arraylists and i need the values of second arraylist which are not in first arraylist.. how can i do this in c#

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          First sort the lists, then you can loop through them side by side and compare the items to find out where they match and where there are items that exist in only one of the lists.

          Experience is the sum of all the mistakes you have done.

          N 1 Reply Last reply
          0
          • G Guffa

            First sort the lists, then you can loop through them side by side and compare the items to find out where they match and where there are items that exist in only one of the lists.

            Experience is the sum of all the mistakes you have done.

            N Offline
            N Offline
            NassosReyzidis
            wrote on last edited by
            #5

            Guffa wrote:

            First sort the lists, then you can loop through them side by side

            He can loop through the first ArrayList and use the .Contains(object item) method for the second array list and not interate through both ArrayLists. just a thought

            Nassos.NET

            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