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

collection

Scheduled Pinned Locked Moved C#
questiondata-structures
8 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.
  • A Offline
    A Offline
    arkiboys
    wrote on last edited by
    #1

    A generic collection i.e. cCurves is populated with data. The collection has several fields. I am interested in two of the fields i.e. Name and Name2 As a test, the following return data from the collection. cCurves[0].Name1 cCurves[0].Name2 cCurves[1].Name cCurves[1].Name2 cCurves[2].Name cCurves[2].Name2 ... How can I use a loop to populate a simple array with the data (Name, Name1 fields for each row) in the above collection please? Thanks

    C K 2 Replies Last reply
    0
    • A arkiboys

      A generic collection i.e. cCurves is populated with data. The collection has several fields. I am interested in two of the fields i.e. Name and Name2 As a test, the following return data from the collection. cCurves[0].Name1 cCurves[0].Name2 cCurves[1].Name cCurves[1].Name2 cCurves[2].Name cCurves[2].Name2 ... How can I use a loop to populate a simple array with the data (Name, Name1 fields for each row) in the above collection please? Thanks

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      for(int i=0; i


      Upcoming events:
      * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services...

      Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton

      My website

      A 2 Replies Last reply
      0
      • C Colin Angus Mackay

        for(int i=0; i


        Upcoming events:
        * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services...

        Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton

        My website

        A Offline
        A Offline
        arkiboys
        wrote on last edited by
        #3

        Can you please simplify the code as it seems to have syntax error. thanks

        C 1 Reply Last reply
        0
        • C Colin Angus Mackay

          for(int i=0; i


          Upcoming events:
          * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services...

          Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton

          My website

          A Offline
          A Offline
          arkiboys
          wrote on last edited by
          #4

          Please note that I am trying to create and populate a simple array from an existing collection. I just realised that I think you are not doing that in your earlier code. Thanks

          1 Reply Last reply
          0
          • A arkiboys

            A generic collection i.e. cCurves is populated with data. The collection has several fields. I am interested in two of the fields i.e. Name and Name2 As a test, the following return data from the collection. cCurves[0].Name1 cCurves[0].Name2 cCurves[1].Name cCurves[1].Name2 cCurves[2].Name cCurves[2].Name2 ... How can I use a loop to populate a simple array with the data (Name, Name1 fields for each row) in the above collection please? Thanks

            K Offline
            K Offline
            Karthik Kalyanasundaram
            wrote on last edited by
            #5

            You can try using foreach loop over this collection.

            A 1 Reply Last reply
            0
            • K Karthik Kalyanasundaram

              You can try using foreach loop over this collection.

              A Offline
              A Offline
              arkiboys
              wrote on last edited by
              #6

              doing this at present for (int i = 0; i <= cCurve.Count; i++) { } not sure how to declare and populate an array from this collection (cCurve)

              P 1 Reply Last reply
              0
              • A arkiboys

                Can you please simplify the code as it seems to have syntax error. thanks

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                arkiboys wrote:

                Can you please simplify the code as it seems to have syntax error.

                Ah... That is because I forgot to HTML encode the < symbol

                for(int i=0; i<numElements; i++)
                {
                cCurves[i].Name1 = whatever;
                cCurves[i].Name2 = whateverelse;
                }


                Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

                1 Reply Last reply
                0
                • A arkiboys

                  doing this at present for (int i = 0; i <= cCurve.Count; i++) { } not sure how to declare and populate an array from this collection (cCurve)

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  Array curve = new Array(cCurve.Count);

                  Deja View - the feeling that you've seen this post before.

                  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