我读过一些关于lambda的文章。 但我对下面的代码有疑问,谁可以向我解释一下?
public class FakeProductRepository : IProductRepository
{
public IEnumerable<Product> Products => new List<Product>
{
new Product { Name = "Football", Price = 25 },
new Product { Name = "Surf board", Price = 179 },
new Product { Name = "Running shoes", Price = 95 }
};
}
public IEnumerable<Product> Products => new List<Product>
如何工作?
为什么当我使用“=”而不是“=&gt;”时发生错误?:
错误CS0535'FakeProductRepository'未实现接口 成员'IProductRepository.Products'