Article View: borland.public.csharpbuilder.language.csharp
Article #553Re: C# 2.0
From: Joe Mayo
Date: Tue, 27 Jul 2004 00:11
Date: Tue, 27 Jul 2004 00:11
35 lines
2421 bytes
2421 bytes
I know one place I'll use anonymous methods - threads. On occasion I want to push some work off to a thread and have to create a separate method that calls other methods. It seems like such a waste to write the extra method and I believe anonymous methods will make those situations a bit clearer. Joe -- Joe Mayo, Author/Instructor Need C#/.NET training? visit www.mayosoftware.com C# Tutorial - www.csharp-station.com "Jon Shemitz" <jon@midnightbeach.com> wrote in message news:410573EE.7DA05388@midnightbeach.com... > "Rudy Velthuis [TeamB]" wrote: > > > I know this is not eas,y since I'd somehow have to pass variables. I > > would rather be using nested, but named methods instead. That way they > > can even be reused. This is IMO not possible in C#. > > Nothing says you can't assign the anonymous method to a named > delegate, but that does sort of defeat the point. There ARE plenty of > times when you write a tiny method that's only used in one call-back; > anonymous methods keep the code together, so you can read (and > maintain) it with less jumping around. > > If there is some point to using the code in more than one place, then > you DO you use a named method, that's all. > > -- > > programmer, author http://www.midnightbeach.com > and father http://www.midnightbeach.com/hs
Technical Details
Message-ID:
<41059d84$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40FE138D.D0A0F368@midnightbeach.com> <41049F97.B701E290@midnightbeach.com> <xn0dl8annr622006-moderator@newsgroups.borland.com> <410544E2.B48A179C@midnightbeach.com> <xn0dl8kopeeohm01r-moderator@newsgroups.borland.com> <410573EE.7DA05388@midnightbeach.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,169d36351e297cad X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Joe Mayo" <jmayo@nospam.mayosoftware.com> Newsgroups: borland.public.csharpbuilder.language.csharp References: <40FE138D.D0A0F368@midnightbeach.com> <41049F97.B701E290@midnightbeach.com> <xn0dl8annr622006-moderator@newsgroups.borland.com> <410544E2.B48A179C@midnightbeach.com> <xn0dl8kopeeohm01r-moderator@newsgroups.borland.com> <410573EE.7DA05388@midnightbeach.com> Subject: Re: C# 2.0 Date: Mon, 26 Jul 2004 18:11:09 -0600 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 67.176.122.65 Message-ID: <41059d84$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1090887044 67.176.122.65 (26 Jul 2004 17:10:44 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail