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. The Lounge
  3. What Language Features Do You Miss In C#?

What Language Features Do You Miss In C#?

Scheduled Pinned Locked Moved The Lounge
csharpjavascriptcomquestiondiscussion
102 Posts 36 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.
  • K Kent Sharkey

    Hmm. So, for every generic, you also get a Foo (with a better name)? Yeah, I could see how that might be handy for reuse: Bag, Bag etc. shoved into a generic Sort(Bag) method?

    -------------- TTFN - Kent

    P Offline
    P Offline
    Paulo Zemek
    wrote on last edited by
    #19

    In my case, actually, for every Foo<T> I also have an IFoo where the parameters are as object instead of T. I think java have such feature (I know, in java the implementation is completely different)... I think they use: Foo<?> to say that they don't know the type being used. It is slower than having it rightly typed, but it is faster than having it as dynamic or through reflection.

    S 1 Reply Last reply
    0
    • K Kent Sharkey

      Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

      -------------- TTFN - Kent

      T Offline
      T Offline
      thrakazog
      wrote on last edited by
      #20

      My answer is always multiple inheritance. Times that I would use it are rare. But when those times come up man do I ever want that.

      Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

      M A 2 Replies Last reply
      0
      • K Kent Sharkey

        Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

        -------------- TTFN - Kent

        S Offline
        S Offline
        Single Step Debugger
        wrote on last edited by
        #21

        Something from Transact SQL – the “in” clause. Something like:

        if(myShoeSize in (16, 12, 17, 32) )
        {
        imAMutant = true;
        }

        There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

        A P 2 Replies Last reply
        0
        • S Single Step Debugger

          Something from Transact SQL – the “in” clause. Something like:

          if(myShoeSize in (16, 12, 17, 32) )
          {
          imAMutant = true;
          }

          There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #22

          There is .Contains.

          Thou mewling ill-breeding pignut!

          S 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            ...And get derisive noises at the next code review! :laugh: Or, you could put both operations in methods and call them?

            If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #23

            A goto case is not a goto. But, yes, I don't like break in a switch; in my opinion break should only be for loops only.

            OriginalGriffO F 2 Replies Last reply
            0
            • S Single Step Debugger

              Something from Transact SQL – the “in” clause. Something like:

              if(myShoeSize in (16, 12, 17, 32) )
              {
              imAMutant = true;
              }

              There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #24

              HashSet

              S 1 Reply Last reply
              0
              • K Kent Sharkey

                Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

                -------------- TTFN - Kent

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #25

                Method-scoped variables like in VB (static). Defining Extension Methods by applying the Attribute like in VB (rather than this). A proper assignment operator like in Pascal := :-D A proper define directive like in C/C++ # define Pi 3.14 Support for enum in where clauses for generic types -- class C<T> where T : enum ... No default modifiers (public, private, virtual, sealed, etc.). Multiple Inheritence would be good too.

                S 1 Reply Last reply
                0
                • P PIEBALDconsult

                  HashSet

                  S Offline
                  S Offline
                  Single Step Debugger
                  wrote on last edited by
                  #26

                  Yes I know. We can also implement it in C++ using operator overloading. But the point is for a language future, not a pattern, collection or utility class.

                  There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                  P 1 Reply Last reply
                  0
                  • A AspDotNetDev

                    There is .Contains.

                    Thou mewling ill-breeding pignut!

                    S Offline
                    S Offline
                    Single Step Debugger
                    wrote on last edited by
                    #27

                    This one is type dependent and not a language future but some class method. Same as Split() (very useful method by the way) or IsNullOrEmpty() for example.

                    There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                    A 1 Reply Last reply
                    0
                    • S Single Step Debugger

                      Yes I know. We can also implement it in C++ using operator overloading. But the point is for a language future, not a pattern, collection or utility class.

                      There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #28

                      Yet HasSet allows other operations, such as union and intersection; would you argue for syntax to allow every such operation? I wouldn't.

                      1 Reply Last reply
                      0
                      • K Kent Sharkey

                        Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

                        -------------- TTFN - Kent

                        H Offline
                        H Offline
                        H Brydon
                        wrote on last edited by
                        #29

                        What I would like to see in the language: - Destructors that destruct (not the silly Dispose() stuff) [you can easily trigger local garbage collection with an exit from scope] - Ability to use arrays with non-zero origin - inline operator||(), inline operator&&() which implement short circuit logic

                        -- Harvey

                        S 1 Reply Last reply
                        0
                        • K Kent Sharkey

                          Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

                          -------------- TTFN - Kent

                          M Offline
                          M Offline
                          Marc Clifton
                          wrote on last edited by
                          #30

                          Multiple inheritance. Interfaces are useful as abstractions, but there are times I want to inherit concrete functionality from multiple classes. Marc

                          Latest Article: C# and Ruby Classes: A Deep Dive
                          My Blog

                          J P 2 Replies Last reply
                          0
                          • K Kent Sharkey

                            Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

                            -------------- TTFN - Kent

                            B Offline
                            B Offline
                            Brady Kelly
                            wrote on last edited by
                            #31

                            I want lambda expressions, that can be evaluated at compile time, allowed in attributes, to avoid nasty string literals.

                            S 1 Reply Last reply
                            0
                            • K Kent Sharkey

                              Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

                              -------------- TTFN - Kent

                              Sander RosselS Offline
                              Sander RosselS Offline
                              Sander Rossel
                              wrote on last edited by
                              #32

                              Having a generic type constraint on operators. Something where T : +, -, >, < Or something. Or just provide one easy way to work with numerics, for example: Something where T : numeric After which you can use +, -, >, < etc. by default and T can be int16, int 32, int64, single, byte, double, decimal or an unsigned of those.

                              It's an OO world.

                              public class Naerling : Lazy<Person>{
                              public void DoWork(){ throw new NotImplementedException(); }
                              }

                              M 1 Reply Last reply
                              0
                              • K Kent Sharkey

                                Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

                                -------------- TTFN - Kent

                                C Offline
                                C Offline
                                Chris C B
                                wrote on last edited by
                                #33

                                On error resume next

                                G K 2 Replies Last reply
                                0
                                • M Marc Clifton

                                  Multiple inheritance. Interfaces are useful as abstractions, but there are times I want to inherit concrete functionality from multiple classes. Marc

                                  Latest Article: C# and Ruby Classes: A Deep Dive
                                  My Blog

                                  J Offline
                                  J Offline
                                  JeremyBob
                                  wrote on last edited by
                                  #34

                                  +1 from me

                                  1 Reply Last reply
                                  0
                                  • K Kent Sharkey

                                    Sure, it's on another discussion site[^], but that doesn't mean we can't also discuss it here. Personally, while it certainly doesn't fit in the "missing" category, I see them moving it closer and closer to a hybrid C#/JavaScript language with each new version.

                                    -------------- TTFN - Kent

                                    M Offline
                                    M Offline
                                    m0sa
                                    wrote on last edited by
                                    #35

                                    - aspect oriented programming (PostSharp...) - mixin support - serializable expressions

                                    1 Reply Last reply
                                    0
                                    • M Marc A Brown

                                      I would like to see the addition of a keyword to allow fallthrough in a switch statement (maybe "nobreak"?). I don't need/want to do that often, so the compiler preventing "accidental" fallthrough is nice; however, it sure would be nice to be able to fall through when necessary.

                                      M Offline
                                      M Offline
                                      Marach
                                      wrote on last edited by
                                      #36

                                      you can type several 'case' statements one after the other. contrived example:

                                      int number = GetNumberBetween1And5();
                                      string text = null;
                                      switch( number ) {
                                      case 1:
                                      text = "1";
                                      break;
                                      case 2:
                                      case 3:
                                      case 4:
                                      text = "2 or 3 or 4";
                                      break;
                                      case 5:
                                      text = "5";
                                      break;
                                      }

                                      is that type of fall-through what you said you're missing?

                                      M 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        A goto case is not a goto. But, yes, I don't like break in a switch; in my opinion break should only be for loops only.

                                        OriginalGriffO Offline
                                        OriginalGriffO Offline
                                        OriginalGriff
                                        wrote on last edited by
                                        #37

                                        I agree - it isn't. But...it is a out-of-structure code flow indicator, which can easily create the same spaghetti code as a goto. So on balance, while I found the no-drop-through rule limiting at first, I don't miss it so much now. I just restructure the code to not need it in the same way that I don't need goto itself. And I definitely agree on break - the switch version should have used a different word: "esac" or "join" perhaps.

                                        If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

                                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                                        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                                        1 Reply Last reply
                                        0
                                        • E Espen Harlinn

                                          You certainly go straight to The Heart of Everything[^]

                                          Espen Harlinn Principal Architect, Software - Goodtech Projects & Services AS Projects promoting programming in "natural language" are intrinsically doomed to fail. Edsger W.Dijkstra

                                          OriginalGriffO Offline
                                          OriginalGriffO Offline
                                          OriginalGriff
                                          wrote on last edited by
                                          #38

                                          Because I have A Dangerous Mind[^] :-D

                                          If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

                                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                                          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                                          E 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