I have this afternoon ...
void TareaFecha()
{
Task T = new Task(() =>
{
DateTime FechaActual = DateTime.Today;
DateTime Inicio = FechaActual.AddDays(8);
MessageBox.Show($"TareaFecha, fecha calculada = {Inicio}");
});
T.Start();
}
I try to pass a whole number as a parameter in the parenthesis on the left side of the lambda; Task T = new Task((dias) =>
to be able to use it later within the function, in the line; DateTime Inicio = FechaActual.AddDays(dias);
and replace it with the constant number 8
but there is no way, with that kind of syntax, where do I assign the value to the parameter?
EDIT:
For example here, I pass the parameter without problem, but, Why?
void TareaFechaParametro()
{
Task T = new Task((dias) => MessageBox.Show($"TareaFecha, fecha calculada = {dias}"), 4);
T.Start();
}