Here is a more concise example which may help to explain it.
void StartNew(Action<object> action, object o) {
action(o);
}
The StartNew
method just takes the action
delegate and invokes it by passing o
as the parameter. The value passed to the lambda is simply the value that is passed into StartNew
after the lambda
// Prints "hello world"
StartNew(o => Console.WriteLine(o), "hello world");
In the case you outlined the value being passed as the second parameter is
new CustomData() {Name = i, CreationTime = DateTime.Now.Ticks}
This just creates a new object of type CustomData
, assigns it some properties and makes it the argument to the lambda defined immediately before it. It will eventually become the value obj
in the lambda