Hello to everyone! I am new to c# and I am creating an address book program. It has to hold 20 entries (first name, last name, street address, city, state and zip). I am trying to figure out how to set up the arrays so that I can add entries, delete entries and shoe the profile info for each entry(user option). here is how my code looks so far.

[string [][] profile = new string[20][];
profile[0] = new string[6];
profile[1] = new string[6];
profile[2] = new string[6];
profile[3] = new string[6];
profile[4] = new string[6];
profile[5] = new string[6];
profile[6] = new string[6];
profile[7] = new string[6];
profile[8] = new string[6];
profile[9] = new string[6];
profile[10] = new string[6];
profile[11] = new string[6];
profile[12] = new string[6];
profile[13] = new string[6];
profile[14] = new string[6];
profile[15] = new string[6];
profile[16] = new string[6];
profile[17] = new string[6];
profile[18] = new string[6];
profile[19] = new string[6];
]

My logic is 20 profiles(entries) and the "new string[6]" is for the user input textboxes. Am I on the right track here?

Recommended Answers

All 2 Replies

Hello, your way is technically correct.
I just want to know .. are you new to c# or to programming at all? Just there is a better way to store data, e.g. using List<T> and structures or classes ..

P.S. Please, next time put your code in code tags :)

Hello, your way is technically correct.
I just want to know .. are you new to c# or to programming at all? Just there is a better way to store data, e.g. using List<T> and structures or classes ..

P.S. Please, next time put your code in code tags :)

As he said, you should really read about object oriented programming this would be really helpful for your process. The way you started, it's going to be painful to organise and and then treat the data. It is a MUST if you want to raise up your skills in programming. But otherwise, if you want to take that path, as Antenka said, it's technically correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.