Re:Mono 3.2.7 is out
by JohnBooty on Wednesday February 26, 2014 @04:28PM
(#7307994)
As others have said, it's idiomatic to name a lambda param "_" if you're not using it.
To perhaps clarify a bit, here's what the Hello World example would look like if we added a second route that uses the lambda parameter, and a third route that does something else, and a fourth route that renders a view template.
public SampleModule() {
Get["/"] = _ => "Hello World!";
Get["/hello/{name}"] = p => ("Hello, " + p.name + "!");
Get["/something-complicated"] = _ => {
// complicated stuff happens here
return "OK... we're all done";
};
// A variety of template engines are supported
Get["/my-resume"] = _ => View["resume.cshtml"];
}
To perhaps clarify a bit, here's what the Hello World example would look like if we added a second route that uses the lambda parameter, and a third route that does something else, and a fourth route that renders a view template.