Marc Davis
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah, yeah...dictionary would work and not a huge ordeal. I will just go with that.
Thanks!
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
https://www.experts-exchange.com/questions/24166603/How-to-Split-a-string-with-multiple-delimiters-into-a-multidimensional-array-in-C.html
ASKER
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. :-)
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.
ASKER