0

Need help with C# List

I am trying to essentially make a multi-dimensional list. it'll take a name and size parameter. I want to be able to create it when i instantiate it. You can find this in my public Battleship Classes code on what I'm trying to do.

21st Nov 2016, 8:28 PM
Daniel Hildreth
Daniel Hildreth - avatar
4 Antworten
+ 2
if the Name was unique you could use a dictionary
21st Nov 2016, 10:04 PM
Martin K.
Martin K. - avatar
0
the name would be unique because you won't be able to change it. it's going to be the names of the battleships in my C# .Net Battleship game. I originally had it as an enum, with the names and sizes being constants. Thought I could make it easier to save to the DB and load without using enums.
21st Nov 2016, 11:04 PM
Daniel Hildreth
Daniel Hildreth - avatar
0
Hey Martin, I made that into a Dictionary class. Dictionaries can take int as parameters right? I tried running it, and got an error with declaring the properties for the dictionary. I wrote X.Add("string", int); and it gave me an error by saying the ( was the error.
21st Nov 2016, 11:22 PM
Daniel Hildreth
Daniel Hildreth - avatar