End Google Ads 201810 - BS.net 01 -->
I have two objects.
Object A holds an event.
Object B assigns an anonymous delegate to Object A's event.
I want to access Object A from the code in the anonymous method.
foreach (Entity target in Entities)
{
[...]
target.OnTouch += new delegate()
{
if (Character == '+')
{
Character = '/';
passableBy = PassableFlags.normal;
}
return;
};
}
Character and passableBy are properties of [target].
It won't compile, it says that Character and passableBy do not exist in the current context.
How can I access properties of the event-holding object?
مواقع النشر (المفضلة)