0

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);
}
1
  • 2
    I would work with some more up-to-date resources: MVC 2.0 is horribly out of date. The current version is 5.0 and works rather differently. Commented Oct 28, 2014 at 10:25

2 Answers 2

2

Just add () to the end of the line:

var allProducts = repository.FindAllProducts();
Sign up to request clarification or add additional context in comments.

Comments

0

FindAllProducts is a method so it requires braces

 var allProducts=repository.FindAllProducts();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.