what is the "_" doing in c# ?

Posted by jmls on 03-Oct-2008 12:08

converting a c# demo (a paint program) over to ABL, I got stuck at this line of code:

this.colorSelector1_ColorSelected( this, new ColorSelectedEventArgs( Color.Black, ImageEditColorType.ForeColor ) );

colorSelector1 is an infragistics.win.ultraimageeditor.colorselector

I am confused about the "_" in here ... and I suppose that Mike or Peter are going to slap their foreheads and go "duhh" ..

All Replies

Posted by Peter Judge on 03-Oct-2008 12:27

this.colorSelector1_ColorSelected( this, new

ColorSelectedEventArgs( Color.Black,

ImageEditColorType.ForeColor ) );

colorSelector1 is an

infragistics.win.ultraimageeditor.colorselector

I believe it's a call to ColorSelector colorSelector1's ColorSelected event handler. I'm assuming that this is on a line by itself?

Some events have a 'perform action' method - like a Close() method on a Form that fires the event. It doesn't look like the ColorSelector* has such a method, so this is the way they chose to fire the event.

I am confused about the "_" in here ... and I suppose

that Mike or Peter are going to slap their foreheads

and go "duhh" ..

This usually only happens when I'm reading my own code ...

-- peter

  • Don't you hate these misspelled names?

Posted by Admin on 03-Oct-2008 13:08

The "_" is the same as in ABL. It's just a legal character in a function/method name.

So this is a call to the event handler named colorSelector1_ColorSelected

No more, no less.

Posted by jmls on 03-Oct-2008 14:08

jeez. Don't you just hate it when you post the most stupid question ever, and you know that people are trying their hardest not to laugh when posting the reply ..

Posted by Admin on 03-Oct-2008 14:12

It could have been worse.

But some answer points would also have been nice.

This thread is closed