Reputation: 1
I am practicing the demo MVC 2.0, but when I create a variable, Visual Studio shows an error
Cannot assign method group to an implicitly-typed local variable
Can you help me to resolve the problem? Here's the code:
public ActionResult ShowAllProducts()
{
var allProducts = repository.FindAllProducts;
return View(allProducts);
}
Upvotes: 0
Views: 59
Reputation: 972
FindAllProducts is a method so it requires braces
var allProducts=repository.FindAllProducts();
Upvotes: 0
Reputation: 5447
Just add ()
to the end of the line:
var allProducts = repository.FindAllProducts();
Upvotes: 2