473,395 Members | 1,978 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.

What differentiates Delegates Beyond Name/Signature

It appears to me that the only things that differentiates any delegates is
(1) the type name, and (2) the signature (return type or void, and
parameters). Is this true?

Take, for instance, the Predicate<Tdelegate in the bcl. It is a required
parameter of the List<T>.Find() method.
Here is its signature:
public delegate bool Predicate<T(T obj)

Is there anything inherently different about that Predicate<Tdelegate than
a delegate that I define, with the same signature?...
public delegate bool MyPredicate<T(T obj)
I understand that when I declare a delegate, the compiler creates a sealed
class on my behalf, that makes use of the delegate signature (type name,
parameters, etc) that I supply. Is there anything - beyond the type name
(Predicate vs MyPredicate) - in that sealed class that differentiates these
two delegates (Predicate vs MyPredicate) once the app is compiled?

I suspect there is no difference (please enlighten me if I'm wrong).
Consequently, a quick followup question (asked 3 different ways):
Is the value of having many pre-defined delegates mostly in the _name_ of
the delegate? That is, are many delegates created simply to convey meaning
about their individual intended roles? In other words - is the only thing
that makes a Predicate<Tdelegate a "predicate delegate" its type name?

Thanks.
Jun 22 '07 #1
2 1258
On Jun 22, 4:52 pm, "Bob Johnson" <A...@B.COMwrote:
It appears to me that the only things that differentiates any delegates is
(1) the type name, and (2) the signature (return type or void, and
parameters). Is this true?
Yes.

<snip>
I suspect there is no difference (please enlighten me if I'm wrong).
Consequently, a quick followup question (asked 3 different ways):
Is the value of having many pre-defined delegates mostly in the _name_ of
the delegate? That is, are many delegates created simply to convey meaning
about their individual intended roles? In other words - is the only thing
that makes a Predicate<Tdelegate a "predicate delegate" its type name?
Exactly. Fortunately, you can create a delegate instance of one type
from a delegate instance of another type so long as the signatures
match.

Jon

Jun 22 '07 #2
Thank you Jon.
Jun 22 '07 #3

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

Similar topics

3
by: Chris Cioffi | last post by:
I started writing this list because I wanted to have definite points to base a comparison on and as the starting point of writing something myself. After looking around, I think it would be a...
8
by: STom | last post by:
I have a C# Winforms app that has 5 Winforms, lets say A through E. A: Data entry. When data is entered here in any field, values are updated on forms C, D, E.(Not B) B: Data entry form. When...
4
by: Jarod_24 | last post by:
What is the point with Delegates in VB.Net What can these things do that we can not allready do with the use of Interfaces, Events and Event handlers and so on... I'd like a discussion on this,...
12
by: Mahesh Devjibhai Dhola [MVP] | last post by:
Hi, I have added few of the events in some control, example code is: btnControl.GotFocus +=new EventHandler(EventHandlingMethod); btnControl.Click +=new EventHandler(EventHandlingMethod);...
3
by: Rich | last post by:
Hello, I recently started using delegates in my VB apps to handle asynchronous operations. Based on the examples that I followed, delegates appear to work in a similar way as Interfaces. ...
20
by: raylopez99 | last post by:
Dvorak is always interesting, albeit speculative. What hidden gem has he found in Vista that helps developers? It can't be .NET/CLI, that's been out forever. RL Vista rollout hides reality...
6
by: =?Utf-8?B?T2xkQ2FEb2c=?= | last post by:
My question is regarding the use of delegates in C#. I see how .Net uses delegates to wire event handlers to events. It’s an object created by a single line of code by the system and that makes...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
69
by: raylopez99 | last post by:
They usually don't teach you in most textbooks I've seen that delegates can be used to call class methods from classes that are 'unaware' of the delegate, so long as the class has the same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.