How does this Lambda expression work?
Hi
Given this code example:-
public readonly Dictionary<Type, Func<Object>> providers = new Dictionary<Type, Func<Object>>();
public void Bind<T>(T instance)
{
providers[typeof(T)] = () => instance;
}
My question is why is a Lambda expression used for the assignment of the parameter "instance" to providers[typeof(T)]?
I tried assigning the "instance" parameter on its own but got a cast\conversion error.
Regards
Steven
Answers (15)
1
Hi,
I think in the above code, the for loop will skip first row. Try giving value of "i" in for loop as -1;
for (int i = -1; i < dataGridView2.Rows.Count - 1; i++)
{
Accepted 0
Midhun T P
Got it, thank you very much!
0
Nilesh Sawardekar
Good suggestion but not working. Changed to 2 my header gone, change to 0 it throw an error (Exception on HRESULT: 0x800A03EC). Any other suggestion?
0
int cellRowIndex = 1;
change value of it and check.