I have a program where I'm adding objects to a dictionary. The dictionary is set up with an int and my custom 'Ship' class. The problem is I need to organize the ships by a variable in the class.
The ship class is -
public class Ship
{
public string Name { get; set; }
public int Attack { get; set; }
public int Engine { get; set; }
public int Shield { get; set; }
public string Team { get; set; }
public string ShipClass { get; set; }
public Ship(string name, int attack, int engine, int shield, string team, string shipClass)
{
Name = name;
Attack = attack;
Engine = engine;
Shield = shield;
Team = team;
ShipClass = shipClass;
}
}
And I need to organize
Dictionary<int,Ship> ShipList = new Dictionary<int,Ship>();
by ShipList[i].Engine where i goes down through each ship I have. Any help would be great.