我的回复无效,错误CS0029暗示:
System.Collections.Generic.List<namesolution>
到namesolution
我如何让我的回归工作?
这是我的代码:
[Route("/getVeiculos")]
public VeiculoModel getVeiculos()
{
List<VeiculoModel> list = new List<VeiculoModel>();
list.Add( new VeiculoModel {
idVeiculo = 1,
corVeiculo = "Verde",
marcaVeiculo = "Volks",
modeloVeiculo = "UP!",
placaVeiculo = "AAA-8754"
});
list.Add(new VeiculoModel
{
idVeiculo = 2,
corVeiculo = "Azul",
marcaVeiculo = "Volks",
modeloVeiculo = "Fusca",
placaVeiculo = "CDV-8754"
});
return list;
}
enter code here
答案 0 :(得分:1)
您的方法getVeiculos()签名表示您正在尝试返回VeiculoModel类型的单个实例,但实现返回VeiculoModel列表。假设实现正确,请将方法签名更新为:
public List<VeiculoModel> getVeiculos()
{
// implementation...
}