473,327 Members | 1,967 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,327 software developers and data experts.

Anonymous Method vs. Anonymous Delegate

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!
Oct 21 '07 #1
3 1856
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]
- mv*@spam.guard.caspershouse.com

"Robert Howells" <A@B.COMwrote in message
news:ea**************@TK2MSFTNGP06.phx.gbl...
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!
Oct 21 '07 #2
Nicholas Paldino [.NET/C# MVP] <mv*@spam.guard.caspershouse.comwrote:
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 - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 21 '07 #3
<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

:-)
Oct 21 '07 #4

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

Similar topics

0
by: Cordell Lawrence | last post by:
Okay guys, We are wondering if this is a bug in Framework 2.0.40607 and looking for some clarification on the issue. Take a look at the folowing code. public delegate bool BoundryTest(int...
3
by: anonymous | last post by:
I believe I ran into an interesting way to create memory leaks in C# 2.0 using anymous delegates. Here is a sample of the code in question. private void Handle_Event(object sender, EventArgs e)...
5
by: cody | last post by:
I have a very funny/strange effect here. if I let the delegate do "return prop.GetGetMethod().Invoke(info.AudioHeader, null);" then I get wrong results, that is, a wrong method is called and I...
4
by: Harold Howe | last post by:
I am running into a situation where the compiler complains that it cannot infer the type parameters of a generic method when one of the function arguments is an anonymous method. Here is a...
7
by: Bill Woodruff | last post by:
I've found it's no problem to insert instances of named delegates as values into a generic dictionary of the form : private Dictionary<KeyType, DelegatemyDictionary = new Dictionary<KeyType,...
3
by: William Stacey [C# MVP] | last post by:
It would be handy to be able to ref "this" from inside an AM such as: (string s) { Console.Writeline(s); DoSomething(this); } So treating am like a method of a class (which it is)....
4
by: Frankie | last post by:
I have just gotten up to speed on what anonymous methods are (syntax, capabilities, etc), and how they can be used with /called via delegates. What I am wondering is... 1. Are they only/mostly...
2
by: Tony | last post by:
Hello! Here I have some text from a book I read. It says: "An interesting point to note concerning anonymous methods is that they are effectively local to the code block that contains them, and...
0
by: Peter Duniho | last post by:
On Mon, 01 Sep 2008 16:14:10 -0700, Blip <blip@krumpli.comwrote: Briefly, an anonymous method is exactly that: a method without a name. When you use the "delegate" keyword to declare an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.