Вопрос

I have a method with this signature,

void Add(Control control, Action redraw)

I need to call it like this

myClass.Add(myControl, {Some code});

Where {Some Code} to be replaced with anonymous function.

P.S. Action redraw doesnt take or return any parameters.

Это было полезно?

Решение

I have found the answer to the question using lambda expressions.

myClass.Add(myControl, () => { myControl.Visible = false; });
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top