Came across the following line in the Composite Application Guidelines.
I know the => is a lambda but what does the () mean?
What are some other examples of this?
What is it called so I can search for it?
this.regionViewRegistry.RegisterViewWithRegion(RegionNames.SelectionRegion
, () => this.container.Resolve<EmployeesListPresenter>().View);
It's a lambda expression that takes 0 arguments
http://msdn.microsoft.com/en-us/library/bb397687.aspx
If you look at x => x + 1
It takes a parameter x and returns x incremented by one. The compiler will use type inference to deduct that x is probably of type int and will return another int so you have a lambda that takes a parameter x of type int and returns an integer.
() => 3;
is the same but doesn't take a parameter, it will return an integer.
() => Console.WriteLine("hello");
Will result in a void method with no parameters.
That's an empty argument list, meaning the lambda expression takes no arguments.