473,804 Members | 3,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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<Tdele gate 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<Tdele gate 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<Tdele gate a "predicate delegate" its type name?

Thanks.
Jun 22 '07 #1
2 1275
On Jun 22, 4:52 pm, "Bob Johnson" <A...@B.COMwrot e:
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<Tdele gate 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
3007
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 waste of time to start writing yet another IDE and so am now thinking in terms of new features/plug-ins for existing systems. Right now I mostly use Komodo Personal and it's pretty close to being what I want. They don't currently support plug-ins,...
8
7400
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 data is entered here in any field, values are updated on forms C, D, E (not A). I am considering using delegates to fire events from forms A & B. In forms C, D, E I will have functions with the same signature and even the same name that just...
4
3416
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, and some practical examples where Delegates would be better/worse to use...
12
1294
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); lblControl.Click +=new EventHandler(EventHandlingMethod); private void EventHandlingMethod(object sender, EventArgs e) { ....... }
3
1177
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. Interfaces define methods and functions that a class which implements the interface must also contain - so I get the impression that an Interface is like a skeleton of the methods... And a delegate defines the arguments for a function which have to...
20
1879
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 Commentary: It's not about customers, it's about developers By John C. Dvorak Last Update: 2:44 PM ET Jan 31, 2007
6
2664
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 perfect sense to me. I understand that there is a lot of code underneath that the system has created that makes it all work, thereby making it pretty efficient for the programmer. Outside of the use of delegates to wire event handlers, you can...
92
6267
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
5598
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 signature for the method (i.e., as below, int Square (int)). Here is an example to show that feature. Note class "UnAwareClass" has its methods Square and Cuber called by a class DelegateClass. This is because these methods in UnAwareClass have the...
0
9587
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.