Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# 2.0 Specs now available

C# 2.0 Specs now available

Scheduled Pinned Locked Moved C#
csharpcomcollaborationdiscussion
17 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Paul Riley

    Good stuff. Partial classes - *cringes* Anonymous methods - useful but dangerous Iterators - cool Generics - SWEET! I was just thinking a couple of days ago how useful something like Generics would be. I'm still asking Santa Claus for default parameter specifiers though. Paul

    L Offline
    L Offline
    leppie
    wrote on last edited by
    #8

    They should have added something like this too: bool **MyClass.**MyMethod(string hello) { return hello == "hello"; } at namespace level. This would allow u to group methods in logical groups and overcome some difficult design problems. leppie::AllocCPArticle("Zee blog");
    Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

    P 2 Replies Last reply
    0
    • E Eric Gunnerson msft

      I think the anonymous delegates are somewhat a matter of taste, and should be used wisely ("If swelling persists, contact a professional programming practitioner immediately"...) There is the opportunity to make your code much more ugly, but there are also cases where you can make it much more local. If you want to be able to have a named iterator that can take some code, or you want to specify the MatchEvaluator for a Regex.Replace(), you can make your code more understandable (probably...) with an anonymous delegate. But I don't view them as a replacement for standard delegates.

      B Offline
      B Offline
      Blake Coverett
      wrote on last edited by
      #9

      The improved locality is a win from a syntax and encapsulation perspective, but must more important to me is the fact that anonymous delegates have closures semantics. This opens up new programming idioms that are just not reasonable otherwise. Yay!! On the other hand, I pouted to see that 'yield' was specialized for iterators and not generalized into support for arbitrary coroutines. Then I winced a bit a 'yield return' replacing just 'yield'. I'd rather a little pain now with a new keyword/breaking change than an ugly syntax forever after. -Blake

      1 Reply Last reply
      0
      • P Paul Riley

        Good stuff. Partial classes - *cringes* Anonymous methods - useful but dangerous Iterators - cool Generics - SWEET! I was just thinking a couple of days ago how useful something like Generics would be. I'm still asking Santa Claus for default parameter specifiers though. Paul

        B Offline
        B Offline
        Blake Coverett
        wrote on last edited by
        #10

        Why do partial classes make you cringe? I don't use generated code much, or at least not where it should be mixed with handwritten code, but it seems a big win for the majority who like code generating tools like form designers. *chuckles* As to anonymous methods being dangerous... mmm, but isn't that half the fun? -Blake

        P 1 Reply Last reply
        0
        • L leppie

          They should have added something like this too: bool **MyClass.**MyMethod(string hello) { return hello == "hello"; } at namespace level. This would allow u to group methods in logical groups and overcome some difficult design problems. leppie::AllocCPArticle("Zee blog");
          Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

          P Offline
          P Offline
          Paul Riley
          wrote on last edited by
          #11

          leppie, You are a sick, sick individual. :-D Paul

          1 Reply Last reply
          0
          • B Blake Coverett

            Why do partial classes make you cringe? I don't use generated code much, or at least not where it should be mixed with handwritten code, but it seems a big win for the majority who like code generating tools like form designers. *chuckles* As to anonymous methods being dangerous... mmm, but isn't that half the fun? -Blake

            P Offline
            P Offline
            Paul Riley
            wrote on last edited by
            #12

            Blake Coverett wrote: mmm, but isn't that half the fun? Yeah, in some respects. I just worry about what some programmers I've had the misfortune to come across could do with such things available to them. Entire hunks of code in initialization routines, just because they can't be bothered to learn how to write a delegate; and classes broken down into hideous numbers of files so that you can never find anything (imagine a project full of controls where all the rendering is done in one file, all the keypress handling in another file, etc - some developers would actually find that logical). For anonymous methods, I could at least see a purpose. I couldn't for partial classes but then I very rarely use generated code, so that never crossed my mind. Now I suppose I have to cringe equally at both. Paul

            1 Reply Last reply
            0
            • L leppie

              They should have added something like this too: bool **MyClass.**MyMethod(string hello) { return hello == "hello"; } at namespace level. This would allow u to group methods in logical groups and overcome some difficult design problems. leppie::AllocCPArticle("Zee blog");
              Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

              P Offline
              P Offline
              Paul Riley
              wrote on last edited by
              #13

              Com to think of it, mate, isn't this one thing that partial classes can be used for? ie. rather than: bool MyClass.MyMethod(string hello) { return hello == "hello"; } do public partial class MyClass { bool MyMethod(string hello) { return hello == "hello"; } } I'm really not sure I think this is a good idea, but it should be possible if there's an extremely good reason for it. Paul

              L 1 Reply Last reply
              0
              • P Paul Riley

                Com to think of it, mate, isn't this one thing that partial classes can be used for? ie. rather than: bool MyClass.MyMethod(string hello) { return hello == "hello"; } do public partial class MyClass { bool MyMethod(string hello) { return hello == "hello"; } } I'm really not sure I think this is a good idea, but it should be possible if there's an extremely good reason for it. Paul

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #14

                Paul Riley wrote: I'm really not sure I think this is a good idea, I hate typing! leppie::AllocCPArticle("Zee blog");
                Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

                P 1 Reply Last reply
                0
                • L leppie

                  Paul Riley wrote: I'm really not sure I think this is a good idea, I hate typing! leppie::AllocCPArticle("Zee blog");
                  Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

                  P Offline
                  P Offline
                  Paul Riley
                  wrote on last edited by
                  #15

                  leppie wrote: I hate typing! Good. Maybe that'll discourage you from breaking up classes across multiple files. ;P Not that you actually have to type in VS.NET, it'll probably do it all for you. :) P Paul

                  1 Reply Last reply
                  0
                  • E Eric Gunnerson msft

                    The specs for C# 2.0 are now available on MSDN at http://msdn.microsoft.com/vcsharp/team/language/default.aspx There is a discussion forum for the language on the same page. Eric Gunnerson Visual C# Compiler PM

                    C Offline
                    C Offline
                    Corinna John
                    wrote on last edited by
                    #16

                    Anonymous classes, cool! I always loved anonymous event handlers in Java. But they have not fixed that break; stuff in the switch blocks. Fall-through or not, there's no reason for typing the same word under every case block.

                    B 1 Reply Last reply
                    0
                    • C Corinna John

                      Anonymous classes, cool! I always loved anonymous event handlers in Java. But they have not fixed that break; stuff in the switch blocks. Fall-through or not, there's no reason for typing the same word under every case block.

                      B Offline
                      B Offline
                      Blake Coverett
                      wrote on last edited by
                      #17

                      Ah but that would surely be a breaking change - think of all the sad programmers. -Blake

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups