我是C#编程的新手,遇到了一些我无法过去的障碍.
我收到这个编译错误:
CS0305:使用泛型类型'System.Collections.Generic.IEnumerable'需要1个类型参数
用这个代码;
class Program
{
static void Main(string[] args)
{
Car c = new Car();
c.PetName = "Frank";
c.Speed = 55;
c.colour = "Green";
Console.WriteLine("Name = : {0}", c.PetName);
c.DisplayStats();
Garage carLot = new Garage();
// Hand over each car in the collection
foreach (Car c in carLot)
{
Console.WriteLine("{0} is going {1} MPH",
c.PetName, c.CurrentSpeed);
}
Console.ReadLine();
}
class Car
{
//Automatic Properties
public string PetName { get; set; }
public int Speed { get; set; } …Run Code Online (Sandbox Code Playgroud) c# ×1