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. Collection of Objects

Collection of Objects

Scheduled Pinned Locked Moved C#
data-structurestutorialquestion
5 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.
  • S Offline
    S Offline
    sreecahitu
    wrote on last edited by
    #1

    Hey All, How to collect the Objects? Like an array, how do we collect the objects?

    C S 2 Replies Last reply
    0
    • S sreecahitu

      Hey All, How to collect the Objects? Like an array, how do we collect the objects?

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

      Do you mean an ArrayList ? Or are you using C# 2.0, then List<object> will do. Replace object with whatever class you want to collect. This is the sort of question that's bound to be covered by a beginners book, I recommend working through a book if you're serious about learning C#.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • S sreecahitu

        Hey All, How to collect the Objects? Like an array, how do we collect the objects?

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

        You can use ArrayList.............. Just declare like ArrayList objArrayList = new ArrayList(); Them you can add the objects objArrayList.Add(obj);

        My small attempt...

        S 1 Reply Last reply
        0
        • S sujithkumarsl

          You can use ArrayList.............. Just declare like ArrayList objArrayList = new ArrayList(); Them you can add the objects objArrayList.Add(obj);

          My small attempt...

          S Offline
          S Offline
          sreecahitu
          wrote on last edited by
          #4

          Hey All, Thank you very much for your kind help. so my question is, hwo could i store the objects of a table(which contains 2 columns and 170 rows) in an arrayList? -- modified at 12:19 Wednesday 18th April, 2007

          S 1 Reply Last reply
          0
          • S sreecahitu

            Hey All, Thank you very much for your kind help. so my question is, hwo could i store the objects of a table(which contains 2 columns and 170 rows) in an arrayList? -- modified at 12:19 Wednesday 18th April, 2007

            S Offline
            S Offline
            sujithkumarsl
            wrote on last edited by
            #5

            You mean you are having objects on each cell... try the foreach method to retrieve all from that. then use arraylist foreach(Datarow row from table.rows { objarrayList.Add(row["item"]; }

            My small attempt...

            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