我有这种类型的变量:方法,返回匿名类型C#
我应该写我的方法是什么样的回报类型的?我写了object
但它没有解决。谢谢。
编辑:
我做了这样的类:
public class IlIlceTarife
{
public string Il { get; set; }
public string Ilce { get; set; }
public string Tarife { get; set; }
}
public class a
{
public IlIlceTarife Name { get; set; }
public int Sayi { get; set; }
}
而且我做的返回类型为这样:
public List<IEnumerable<a>> TarifeGiver1(string il, string ilce)
而且VS给了这个错误:
> Cannot implicitly convert type
> 'System.Collections.Generic.List<System.Collections.Generic.IEnumerable<<anonymous
> type: <anonymous type: string Il, string Ilce, string Tarife> Name,
> int Sayi>>>' to
> 'System.Collections.Generic.List<System.Collections.Generic.IEnumerable<WebApplication2.Controllers.a>>'
编写类来代替。 –
为什么你给一个班级一个名字'a'?这是我可以想象得出的最无名的名字 –
@TimSchmelter我以后会改变它。只是写了很快。 – jason