In the code block below I would expect dictCars to contain: { Chevy:Camaro, Dodge:Charger }
But, dictCars comes back empty. Because this line returns false each time it
You can add this code, by implementing IEquatable
IEquatable
public class Car: IEquatable { ...... public bool Equals( Car other ) { return this.CarID == other.CarID && this.CarName == other.CarName; } }
Link : http://msdn.microsoft.com/fr-fr/library/vstudio/ms131187.aspx