我正在尝试通过属性值删除该项目。 删除方法有什么问题?
using System.Collections.Generic;
namespace Autoworld
{
class GoodCars
{
static List<Tech> cars = new List<Tech>();
public class Tech
{
public string Name { get; set; }
public double KM { get; set; }
}
static void Main()
{
cars.Add(new Tech()
{
Name = "Lada Vesta Sport",
KM = 190
});
cars.Remove(new Tech()
{
Name = cars[0].Name
});
}
}
}