class Program
{
static void Main(string[] args)
{
Car car1 = new Car();
car1.Make = "Oldsmobile";
car1.Model = "Cultas Supreme";
Car car2 = new Car();
car2.Make = "GEO";
car2.Model = "Prism";
Dictionary<string, Car> myDicitionary = new Dictionary<string, Car>();
myDicitionary.Add(car1.Model, car1);
myDicitionary.Add(car2.Model, car2);
foreach (KeyValuePair<string, Car> CAR in myDicitionary)
{
Console.WriteLine("{0}-- {1}", CAR.Key,CAR.Value);
}
Console.ReadLine();
}
class Car
{
public string Make { get; set; }
public string Model { get; set; }
}
}
出力結果
Cultas Supreme-- Collection.Programe+Car Prism--
Collection.Program+Car
しかし、 Collection.Programe+Car` の代わりに Car の値が表示されないのはなぜですか