I came across a code, which is bit confusing for me. In the below code, isVisible is not declared, still it is able to assign value to the delegate.
Action<bool> onChangeLoader = (isVisible) => { };
I came across a code, which is bit confusing for me. In the below code, isVisible is not declared, still it is able to assign value to the delegate.
Action<bool> onChangeLoader = (isVisible) => { };
That code is equivalent to having this method:
private void DoSomething(bool isVisible)
{
}
and then assigning a delegate for that method to a variable:
Action<bool> onChangeLoader = DoSomething;
After that, anywhere that you might call the DoSomething
method, you could invoke the onChangeLoader
delegate.