Hello all,
I'm new to C# and I'm hitting a brick wall on this.
I've skimmed through the posts regarding arrays and their elements and was unable to find the information I was looking for, so hopefully I'm not blind and someone will be kind enough to help me out :)
Using a standard 2D array I need to assign it a new class instance that contains several values. My setup needs to be like below, so dictionaries etc. won't help me much and they're a bit over my head right now anyway.
object[] testArray = new object[2];
testArray[0] = new className(100, 1.5, 3);
testArray[1] = new anotherClass(20 0, 3.5, 4);
I need to be able to go through each array index and pull out the third item in each element of that index. So I would need to pull out the 3 or the 4 for each of these two indexes.
I've tried running through the Array methods, but haven't come up with anything so far that I could use. I'm not looking for anyone to code it for me, as that would be silly, but if you could provide a point in the right direction that would be great :)
Thanks in advance!
I'm new to C# and I'm hitting a brick wall on this.
I've skimmed through the posts regarding arrays and their elements and was unable to find the information I was looking for, so hopefully I'm not blind and someone will be kind enough to help me out :)
Using a standard 2D array I need to assign it a new class instance that contains several values. My setup needs to be like below, so dictionaries etc. won't help me much and they're a bit over my head right now anyway.
object[] testArray = new object[2];
testArray[0] = new className(100, 1.5, 3);
testArray[1] = new anotherClass(20 0, 3.5, 4);
I need to be able to go through each array index and pull out the third item in each element of that index. So I would need to pull out the 3 or the 4 for each of these two indexes.
I've tried running through the Array methods, but haven't come up with anything so far that I could use. I'm not looking for anyone to code it for me, as that would be silly, but if you could provide a point in the right direction that would be great :)
Thanks in advance!
Comment