Link to home
Start Free TrialLog in
Avatar of Marc Davis
Marc DavisFlag for United States of America

asked on

Multi Dimensional Array and C#

Hi,

I have something like the following string. "Smith, Jones, Hughes".

It's comma-delimited. I can split that based on a "," into an array.  

But what I need is a 2 dimensional array after that string is supplied.

So, something like:

Smith
     N
Jones
    N
Hughes
    N

Later in my processing I will change like:

Jones
    Y

Initially, I need to start with a "Smith, Jones, Hughes" but I need to have a single-dimensional array go into a 2 dimensional array where the second dimensional defaults to an "N".

Later, when necessary I will update to a "Y" for an specific first index.

How would/could I do this?

Any information would be greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of dustock
dustock
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marc Davis

ASKER

I understand I can do it in different means but an array would be more a quick hit type of thing. How can I do it with a 2 dimensional array?
Ah, yeah...dictionary would work and not a huge ordeal. I will just go with that.

Thanks!
Just in case you wanted to know, this question gives a good explanation on how to split your string into a 2d array.

https://www.experts-exchange.com/questions/24166603/How-to-Split-a-string-with-multiple-delimiters-into-a-multidimensional-array-in-C.html
Yeah, I saw that. :-) It's really completely applicable because it's assuming the ":" is already there. I'm putting a "Y" or "N" after the fact.

Thanks though...the dictionary still it working. :-)
I personally find the dictionary a little bit easier to work with, but there are times where arrays are the way to go.  Glad I was able to help you find a solution.