At least I think what I'm referring to is a delegate. Here's my scenario
bool allow_login;
StationDC.Load(query, p =>
{
if (p.Entities.SingleOrDefault(q => q.Category == "Site Status").Value == "Offline") allow_login = false;
else allow_login = true;
}, true);
I still only barely understand what's actually going on here, but from what I do know the delegate I'm passing to StationDC.Load
runs asynchronously, even if on the same thread. I'm confused though that I can access the boolean allow_login
since I always thought delegates were more like a separate method, so should be in a different scope. Anyone have some insight as to what's going on under the hood here? How is my boolean persisting to still be around when my delegate is called?