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. Array? Or how can i do this...

Array? Or how can i do this...

Scheduled Pinned Locked Moved C#
questiondata-structuressaleshelptutorial
22 Posts 10 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 softwarejaeger

    Hello, i have a problem, i create a class for example for each customer, now i want to held all "customers" so the class of them in a array... how can i do this? it must be possible to delete objects, and add them to this array... and is that possible with arrays? thanks

    C Offline
    C Offline
    carbon_golem
    wrote on last edited by
    #5

    Try using a generic list. You can do all sorts of things with it. Scott P

    "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

    C 1 Reply Last reply
    0
    • C carbon_golem

      Try using a generic list. You can do all sorts of things with it. Scott P

      "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

      C Offline
      C Offline
      carbon_golem
      wrote on last edited by
      #6

      HAHA Everyone jumped on this one :laugh:

      "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

      P 1 Reply Last reply
      0
      • C carbon_golem

        HAHA Everyone jumped on this one :laugh:

        "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

        P Offline
        P Offline
        phannon86
        wrote on last edited by
        #7

        Hehe yea, I like to promote the use of generic List wherever possible :)

        He who makes a beast out of himself gets rid of the pain of being a man

        1 Reply Last reply
        0
        • S softwarejaeger

          Hello, i have a problem, i create a class for example for each customer, now i want to held all "customers" so the class of them in a array... how can i do this? it must be possible to delete objects, and add them to this array... and is that possible with arrays? thanks

          A Offline
          A Offline
          Anthony Mushrow
          wrote on last edited by
          #8

          Has anyone suggested using a list yet? :laugh:

          My current favourite word is: Bacon!

          -SK Genius

          C 1 Reply Last reply
          0
          • A Anthony Mushrow

            Has anyone suggested using a list yet? :laugh:

            My current favourite word is: Bacon!

            -SK Genius

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #9

            I would suggest a book instead. :-D

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

            L 1 Reply Last reply
            0
            • C CPallini

              I would suggest a book instead. :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #10

              I already have a book. If I buy a second book, should I keep them in an array, or do you have a better suggestion? :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


              P C G 3 Replies Last reply
              0
              • L Luc Pattyn

                I already have a book. If I buy a second book, should I keep them in an array, or do you have a better suggestion? :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


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

                Luc Pattyn wrote:

                I already have a book. If I buy a second book, should I keep them in an array, or do you have a better suggestion?

                Is one of those books a Dictionary?

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

                My blog | My articles

                L 1 Reply Last reply
                0
                • P Pete OHanlon

                  Luc Pattyn wrote:

                  I already have a book. If I buy a second book, should I keep them in an array, or do you have a better suggestion?

                  Is one of those books a Dictionary?

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

                  My blog | My articles

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #12

                  Pete O'Hanlon wrote:

                  Is one of those books a Dictionary?

                  I don't read recursive books, they either take too long or suddenly end in a painful StackOverflowException. :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                  P 1 Reply Last reply
                  0
                  • L Luc Pattyn

                    I already have a book. If I buy a second book, should I keep them in an array, or do you have a better suggestion? :)

                    Luc Pattyn [Forum Guidelines] [My Articles]


                    This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                    C Offline
                    C Offline
                    CPallini
                    wrote on last edited by
                    #13

                    Luc Pattyn wrote:

                    I already have a book. If I buy a second book, should I keep them in an array, or do you have a better suggestion?

                    Yes, of course, books should stay into the stacks. :-D

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                    1 Reply Last reply
                    0
                    • S softwarejaeger

                      Hello, i have a problem, i create a class for example for each customer, now i want to held all "customers" so the class of them in a array... how can i do this? it must be possible to delete objects, and add them to this array... and is that possible with arrays? thanks

                      C Offline
                      C Offline
                      ChrisKo 0
                      wrote on last edited by
                      #14

                      I'll change up the recommendations. If you only need Add() and Remove() functionality, I would say to use the Generic Collection class from the System.Collections.ObjectModel namespace instead and avoid the extra bloat of the Generic List.

                      1 Reply Last reply
                      0
                      • L Luc Pattyn

                        Pete O'Hanlon wrote:

                        Is one of those books a Dictionary?

                        I don't read recursive books, they either take too long or suddenly end in a painful StackOverflowException. :)

                        Luc Pattyn [Forum Guidelines] [My Articles]


                        This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


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

                        Luc Pattyn wrote:

                        I don't read recursive books, they either take too long or suddenly end in a painful StackOverflowException.

                        :laugh: Does this result in you performing a core dump?

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

                        My blog | My articles

                        L 1 Reply Last reply
                        0
                        • P Pete OHanlon

                          Luc Pattyn wrote:

                          I don't read recursive books, they either take too long or suddenly end in a painful StackOverflowException.

                          :laugh: Does this result in you performing a core dump?

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

                          My blog | My articles

                          L Offline
                          L Offline
                          Luc Pattyn
                          wrote on last edited by
                          #16

                          No, I don't do core dumps either, analyzing them also puts me in an eternal loop. :)

                          Luc Pattyn [Forum Guidelines] [My Articles]


                          This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                          1 Reply Last reply
                          0
                          • L Luc Pattyn

                            I already have a book. If I buy a second book, should I keep them in an array, or do you have a better suggestion? :)

                            Luc Pattyn [Forum Guidelines] [My Articles]


                            This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


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

                            You can make a LIFO stack in the corner. Or buy some string and make a linked list. Or buy two buckets and make a hash table.

                            Despite everything, the person most likely to be fooling you next is yourself.

                            L 1 Reply Last reply
                            0
                            • G Guffa

                              You can make a LIFO stack in the corner. Or buy some string and make a linked list. Or buy two buckets and make a hash table.

                              Despite everything, the person most likely to be fooling you next is yourself.

                              L Offline
                              L Offline
                              Luc Pattyn
                              wrote on last edited by
                              #18

                              Buying buckets to store books. That's a novel concept, I'll have to ponder that a while. However my first book isn't waterproof... So I'll go for the string, bind the books together, and get rid of the problem. I can store one bucket in the corner (that will come handy some day), and no need for a stack, so now I have a spare bucket. Any suggestions how I can keep two buckets in an orderly fashion? an array of buckets? Anyone with a better idea? :)

                              Luc Pattyn [Forum Guidelines] [My Articles]


                              This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                              G 1 Reply Last reply
                              0
                              • L Luc Pattyn

                                Buying buckets to store books. That's a novel concept, I'll have to ponder that a while. However my first book isn't waterproof... So I'll go for the string, bind the books together, and get rid of the problem. I can store one bucket in the corner (that will come handy some day), and no need for a stack, so now I have a spare bucket. Any suggestions how I can keep two buckets in an orderly fashion? an array of buckets? Anyone with a better idea? :)

                                Luc Pattyn [Forum Guidelines] [My Articles]


                                This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


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

                                Another idea for storing books would be a table. One book on the table, and one to keep it level. Or perhaps a tree of some sort. If you already have the string.

                                Luc Pattyn wrote:

                                Any suggestions how I can keep two buckets in an orderly fashion?

                                Buckets are usually very stackable, at least when empty. Otherwise you can just put them in boxes and throw them in a heap.

                                Despite everything, the person most likely to be fooling you next is yourself.

                                L 1 Reply Last reply
                                0
                                • G Guffa

                                  Another idea for storing books would be a table. One book on the table, and one to keep it level. Or perhaps a tree of some sort. If you already have the string.

                                  Luc Pattyn wrote:

                                  Any suggestions how I can keep two buckets in an orderly fashion?

                                  Buckets are usually very stackable, at least when empty. Otherwise you can just put them in boxes and throw them in a heap.

                                  Despite everything, the person most likely to be fooling you next is yourself.

                                  L Offline
                                  L Offline
                                  Luc Pattyn
                                  wrote on last edited by
                                  #20

                                  Guffa wrote:

                                  Buckets are usually very stackable, at least when empty. Otherwise you can just put them in boxes and throw them in a heap.

                                  Aha, buckets can be boxed, hence they are value types, hence I don't need my string to link them together, I'll use it to bind the books instead as I already was going to; so all I need now is two boxes. In the end, in order to store two books, I need two boxes. Right. OO is simple after all, it just takes a while to get used to it. Now that we discovered all this, do we still need the second book? and the buckets? and the string? the boxes? And if we only need a single book, what is all this OO about?? :)

                                  Luc Pattyn [Forum Guidelines] [My Articles]


                                  This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                                  G 1 Reply Last reply
                                  0
                                  • L Luc Pattyn

                                    Guffa wrote:

                                    Buckets are usually very stackable, at least when empty. Otherwise you can just put them in boxes and throw them in a heap.

                                    Aha, buckets can be boxed, hence they are value types, hence I don't need my string to link them together, I'll use it to bind the books instead as I already was going to; so all I need now is two boxes. In the end, in order to store two books, I need two boxes. Right. OO is simple after all, it just takes a while to get used to it. Now that we discovered all this, do we still need the second book? and the buckets? and the string? the boxes? And if we only need a single book, what is all this OO about?? :)

                                    Luc Pattyn [Forum Guidelines] [My Articles]


                                    This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


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

                                    Books are usually already bound when you buy them. If you use thread instead of string, and make a doubly linked list, it would be multi threaded. I hope that you don't have a single threaded apartment. If you have only one book, you could get some glue and make it static.

                                    Despite everything, the person most likely to be fooling you next is yourself.

                                    L 1 Reply Last reply
                                    0
                                    • G Guffa

                                      Books are usually already bound when you buy them. If you use thread instead of string, and make a doubly linked list, it would be multi threaded. I hope that you don't have a single threaded apartment. If you have only one book, you could get some glue and make it static.

                                      Despite everything, the person most likely to be fooling you next is yourself.

                                      L Offline
                                      L Offline
                                      Luc Pattyn
                                      wrote on last edited by
                                      #22

                                      Guffa wrote:

                                      Books are usually already bound when you buy them

                                      Yes, of course, but I was given the advice of storing the books in buckets, and they fell apart; no one told me to buy empty buckets. And I wish I'd gotten the glue advice first. Yes mine is a typical singles apartment, how did you guess? :)

                                      Luc Pattyn [Forum Guidelines] [My Articles]


                                      This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                                      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