I've got a loop that will need to "mark" functions to run later, after the loop is completed. Is that possible to do?
Thanks, Tyler
You can store the function in a delegate:
private void Test(object bar)
{
// Using lambda expression that captures parameters
Action forLater = () => foo(bar);
// Using method group directly
Action<object> forLaterToo = foo;
// later
forLater();
forLaterToo(bar);
}
private void foo(object bar)
{
//...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With