by Mikael Henriksson
12. April 2009 20:31
I am not sure this is liked by many (if any) but I hate having to write too much. Back to being lazy and I love to take shortcuts. One thing I really like doing is to shorten like follows:
public ActionResult Index()
{
return View(new Repository().GetAll<News>());
}
Personally I feel this is almost as readable as the alternative but saves my keyboard a few years in the long run:
public ActionResult Index()
{
var repository = new Repository();
var list = repository.GetAll<News>();
return View(list);
}
106712d9-ff2c-4a83-8fc5-cbbfe75aac41|0|.0
Tags: MVC
MVC