Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
JokeRe: ALEX POST IT HERE PLEASE!!!! Pin
kstls30-Jun-09 22:58
kstls30-Jun-09 22:58 
QuestionSorting by various fields Pin
Quake2Player30-Jun-09 15:12
Quake2Player30-Jun-09 15:12 
AnswerRe: Sorting by various fields Pin
Christian Graus30-Jun-09 18:36
protectorChristian Graus30-Jun-09 18:36 
AnswerRe: Sorting by various fields Pin
dojohansen30-Jun-09 23:56
dojohansen30-Jun-09 23:56 
Questionhow to generate a mobile agent from sms?? Pin
razmeenia30-Jun-09 13:35
razmeenia30-Jun-09 13:35 
QuestionProblem to call method from a WebSercive... Pin
Mtyb30-Jun-09 12:51
Mtyb30-Jun-09 12:51 
AnswerRe: Problem to call method from a WebSercive... Pin
Christian Graus30-Jun-09 13:28
protectorChristian Graus30-Jun-09 13:28 
GeneralRe: Problem to call method from a WebSercive... Pin
Mtyb30-Jun-09 14:14
Mtyb30-Jun-09 14:14 
GeneralRe: Problem to call method from a WebSercive... Pin
Christian Graus30-Jun-09 14:38
protectorChristian Graus30-Jun-09 14:38 
GeneralRe: Problem to call method from a WebSercive... Pin
Mtyb30-Jun-09 14:44
Mtyb30-Jun-09 14:44 
GeneralRe: Problem to call method from a WebSercive... Pin
Christian Graus30-Jun-09 14:54
protectorChristian Graus30-Jun-09 14:54 
Questionabout Visual studio 2010 beta 1 Pin
Seraph_summer30-Jun-09 10:47
Seraph_summer30-Jun-09 10:47 
AnswerRe: about Visual studio 2010 beta 1 Pin
Abhijit Jana30-Jun-09 10:53
professionalAbhijit Jana30-Jun-09 10:53 
AnswerRe: about Visual studio 2010 beta 1 Pin
Christian Graus30-Jun-09 11:12
protectorChristian Graus30-Jun-09 11:12 
GeneralRe: about Visual studio 2010 beta 1 Pin
DaveyM6930-Jun-09 12:11
professionalDaveyM6930-Jun-09 12:11 
GeneralRe: about Visual studio 2010 beta 1 Pin
Christian Graus30-Jun-09 13:28
protectorChristian Graus30-Jun-09 13:28 
GeneralRe: about Visual studio 2010 beta 1 Pin
Seraph_summer30-Jun-09 23:35
Seraph_summer30-Jun-09 23:35 
GeneralRe: about Visual studio 2010 beta 1 Pin
Dan Neely1-Jul-09 10:59
Dan Neely1-Jul-09 10:59 
Questioncurve from bezier cusps Pin
googlejumbo30-Jun-09 10:11
googlejumbo30-Jun-09 10:11 
AnswerRe: curve from bezier cusps Pin
molesworth30-Jun-09 22:09
molesworth30-Jun-09 22:09 
GeneralRe: curve from bezier cusps Pin
googlejumbo1-Jul-09 7:12
googlejumbo1-Jul-09 7:12 
GeneralRe: curve from bezier cusps Pin
molesworth1-Jul-09 11:42
molesworth1-Jul-09 11:42 
QuestionAnonymous methods problem Pin
Narvius30-Jun-09 10:07
Narvius30-Jun-09 10:07 
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?

[Edit]
Note: This code is in Object B, and [target] point to Object A, for clarification.

modified on Tuesday, June 30, 2009 4:19 PM

AnswerRe: Anonymous methods problem Pin
Christian Graus30-Jun-09 10:29
protectorChristian Graus30-Jun-09 10:29 
GeneralRe: Anonymous methods problem Pin
Narvius30-Jun-09 10:37
Narvius30-Jun-09 10:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.