PC Review


Reply
Thread Tools Rate Thread

Anonymous Method vs. Anonymous Delegate

 
 
Robert Howells
Guest
Posts: n/a
 
      21st Oct 2007
Is there any such thing as an "anonymous delegate"? I understand what an
anonymous method is, but I'm unclear of the concept of anonymous delegate
(if it is even a valid term to be using). Is an "anoymous delegate" simply
an anonymous method used in conjunction with a delegate declaration?

Thanks!


 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      21st Oct 2007
Robert,

I haven't heard the term "anonymous method" used at all. It's usually
"anonymous delegate" since the only way you can access it is through a
delegate instance.

When the compiler comes across the anonymous delegate, it will create a
method on a class which the delegate will then point to with a
compiler-generated name.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Robert Howells" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there any such thing as an "anonymous delegate"? I understand what an
> anonymous method is, but I'm unclear of the concept of anonymous delegate
> (if it is even a valid term to be using). Is an "anoymous delegate" simply
> an anonymous method used in conjunction with a delegate declaration?
>
> Thanks!
>


 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      21st Oct 2007
Nicholas Paldino [.NET/C# MVP] <(E-Mail Removed)> wrote:
> I haven't heard the term "anonymous method" used at all. It's usually
> "anonymous delegate" since the only way you can access it is through a
> delegate instance.


I'd say it's the other way round, actually. I've only ever seen
"anonymous delegate" here on the newsgroup, used loosely. It doesn't
appear anywhere in the spec.

"Anonymous method" is the term used in the spec. "Anonymous function"
is also used in the C# 3 spec to cover both anonymous methods and
lambda expressions.

> When the compiler comes across the anonymous delegate, it will create a
> method on a class which the delegate will then point to with a
> compiler-generated name.


Nah, that's what happens when the compiler comes across an anonymous
method

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Bob Cramer
Guest
Posts: n/a
 
      21st Oct 2007
<snip>

RE:
> I'd say it's the other way round, actually. I've only ever seen
> "anonymous delegate" here on the newsgroup, used loosely. It doesn't
> appear anywhere in the spec.


Google agrees with you. A search for...

"anonymous method" returns 10,500,000 hits
"anonymous delegate" returns 1,340,000 hits

.... and we all know that Google is The Final Authority

:-)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to overload an anonymous method to a delegate? news.microsoft.com Microsoft C# .NET 0 25th Mar 2009 11:56 AM
Anonymous Delegate Stefan Hoffmann Microsoft C# .NET 5 29th Aug 2008 06:39 PM
Perils and Merits of Anonymous classes? Anonymous Descendant class Siegfried Heintze Microsoft C# .NET 6 24th Feb 2008 03:50 AM
Unsubscribing an anonymous delegate? David Veeneman Microsoft C# .NET 2 27th Nov 2007 03:00 PM
BeginInvoke and anonymous delegate Dean Shimic Microsoft C# .NET 11 4th Sep 2006 08:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:57 AM.