日期:2014-05-17 浏览次数:20845 次
public class Garage:IEnumerable
{
Car[] carArray = new Car[4];
//启动时填充一些Car对象
public Garage()
{
carArray[0] = new Car("Rusty", 30);
carArray[1] = new Car("Clunker", 50);
carArray[2] = new Car("Zippy", 30);
carArray[3] = new Car("Fred", 45);
}
public IEnumerator GetEnumerator()
{
return this.carArray.GetEnumerator();
}
}
public class Car
{
public Car(){};
}
public class Car
{
public string Type { get; set; }
public int Count { get; set; }
}