473,395 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Delegate parameters...

Hi,

In Delphi all the events that 'it' generates, e.g. a button click, there is
a default parameter Sender of type TObject, so whenever I defined my own I
always did that too, so now converting one of my programs to C# I am
wondering if it is a 'standard' that is generally adopted when defining
delegates in C#?

thoughts anyone?

cheers
Colin
Nov 17 '05 #1
3 3293
A lot of information can be found in the naming guidelines...
http://msdn.microsoft.com/library/de...guidelines.asp
http://msdn.microsoft.com/library/de...guidelines.asp

--
Tim Wilson
..Net Compact Framework MVP

"Colin Basterfield" <co**************@hotmail.com> wrote in message
news:e0**************@tk2msftngp13.phx.gbl...
Hi,

In Delphi all the events that 'it' generates, e.g. a button click, there is a default parameter Sender of type TObject, so whenever I defined my own I
always did that too, so now converting one of my programs to C# I am
wondering if it is a 'standard' that is generally adopted when defining
delegates in C#?

thoughts anyone?

cheers
Colin

Nov 17 '05 #2
Colin,

You'll have to be more careful with the SECOND argument of events than with
the first.
Events in C# have a first argument (Object sender) that work just like in
Delphi, but the second argument (EventArgs args) should be of the predefined
class EventArgs or a class created by yourself that inherits from EventArgs.
If your events supply some information to the outside world, you must create
your own EventArgs class.
This is much more OO than in Delphi, where the mouse events had a different
signature than keyboard events, etc.

Regards - Octavio

"Colin Basterfield" <co**************@hotmail.com> escribió en el mensaje
news:e0**************@tk2msftngp13.phx.gbl...
Hi,

In Delphi all the events that 'it' generates, e.g. a button click, there
is a default parameter Sender of type TObject, so whenever I defined my
own I always did that too, so now converting one of my programs to C# I am
wondering if it is a 'standard' that is generally adopted when defining
delegates in C#?

thoughts anyone?

cheers
Colin

Nov 17 '05 #3
Hi Tim,

Many thanks for this the links proved extermely useful!

Cheers
Colin

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
A lot of information can be found in the naming guidelines...
http://msdn.microsoft.com/library/de...guidelines.asp
http://msdn.microsoft.com/library/de...guidelines.asp

--
Tim Wilson
.Net Compact Framework MVP

"Colin Basterfield" <co**************@hotmail.com> wrote in message
news:e0**************@tk2msftngp13.phx.gbl...
Hi,

In Delphi all the events that 'it' generates, e.g. a button click, there

is
a default parameter Sender of type TObject, so whenever I defined my own
I
always did that too, so now converting one of my programs to C# I am
wondering if it is a 'standard' that is generally adopted when defining
delegates in C#?

thoughts anyone?

cheers
Colin


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Wiktor Zychla | last post by:
Hello, I wonder why the delegate declaration needs named parameters? public delegate void MyDelegate( int a, int b ); // ok public delegate void MyDelegate( int, int ); // compiler error...
2
by: Ruediger Klaehn | last post by:
I have written an arithmetic expression compiler. Now that it is finished I would like to give it a nice interface. Currently I have this interface: delegate double Function(double x); class...
3
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
11
by: matsi.inc | last post by:
I am looking to make something like a delegate that i can use in my projects but am having a hard time getting started. The behavior I am most interested in is how a delegate changes it's Invoke...
10
by: vcquestions | last post by:
Hi. Is there way to have a function pointer to a delegate in c++/cli that would allow me to pass delegates with the same signatures as parameters to a method? I'm working with managed code. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.