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 2 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.
  • 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.

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

    OriginalGriff wrote:

    Or, you could put both operations in methods and call them?

    Not great for all scenarios. FYI, I am talking about "goto case", not "goto label". The former is limited in scope and so isn't plagued by the spaghetti caused by the latter. :)

    Thou mewling ill-breeding pignut!

    M OriginalGriffO 2 Replies Last reply
    0
    • A AspDotNetDev

      You can use "goto" for a similar result.

      Thou mewling ill-breeding pignut!

      M Offline
      M Offline
      Marc A Brown
      wrote on last edited by
      #11

      I could but then my keyboard would jump up and strangle me with the cable. :)

      1 Reply Last reply
      0
      • A AspDotNetDev

        OriginalGriff wrote:

        Or, you could put both operations in methods and call them?

        Not great for all scenarios. FYI, I am talking about "goto case", not "goto label". The former is limited in scope and so isn't plagued by the spaghetti caused by the latter. :)

        Thou mewling ill-breeding pignut!

        M Offline
        M Offline
        Marc A Brown
        wrote on last edited by
        #12

        Ah, that's what you meant. I hadn't considered such a thing.

        1 Reply Last reply
        0
        • A AspDotNetDev

          OriginalGriff wrote:

          Or, you could put both operations in methods and call them?

          Not great for all scenarios. FYI, I am talking about "goto case", not "goto label". The former is limited in scope and so isn't plagued by the spaghetti caused by the latter. :)

          Thou mewling ill-breeding pignut!

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

          That's not very nice at all: since cases aren't named, they would either have to be anonymous (in which case a maintenance PITA if I insert a case between this and the next) or "goto case myEnum.myValue" which is kinda repellent as well. :laugh:

          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
          • 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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #14

            Compile-time templates, C++ style. Generics are great, unless you want to restrict a generic type argument to be "addable" or something like that. Probably not going to happen, given the direction it's taking. Also nice, "break out of named-loop", Java-style.

            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
              Paulo Zemek
              wrote on last edited by
              #15

              Support to use untyped generics. That is, everytime I have a generic type I also create a non-generic interface so I can use the object without using reflection/dynamic but with a considerable good speed. But it would be great if that was automatic. That is: List<int> only accepts int. I receive it in as a List<> parameter. In this case, all the T parameters, usually seen as int, could be seen as object, doing the casts that are necessary... Well, for the List itself we can already use the IList... but it will be great to have such resource so we could avoid creating interfaces to allow "the more generic, non-generic" call (that is, more generic because it is untyped... I also hate the name generic... it should be typed... a typed list... the ArrayList is the generic one... hehe).

              K 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                Telepathic interface and direct print to the coffee machine.

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

                E Offline
                E Offline
                Espen Harlinn
                wrote on last edited by
                #16

                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 1 Reply Last reply
                0
                • P Paulo Zemek

                  Support to use untyped generics. That is, everytime I have a generic type I also create a non-generic interface so I can use the object without using reflection/dynamic but with a considerable good speed. But it would be great if that was automatic. That is: List<int> only accepts int. I receive it in as a List<> parameter. In this case, all the T parameters, usually seen as int, could be seen as object, doing the casts that are necessary... Well, for the List itself we can already use the IList... but it will be great to have such resource so we could avoid creating interfaces to allow "the more generic, non-generic" call (that is, more generic because it is untyped... I also hate the name generic... it should be typed... a typed list... the ArrayList is the generic one... hehe).

                  K Offline
                  K Offline
                  Kent Sharkey
                  wrote on last edited by
                  #17

                  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 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

                    S Offline
                    S Offline
                    Steve Wellens
                    wrote on last edited by
                    #18

                    sprintf sscanf

                    Steve Wellens

                    G S 2 Replies Last reply
                    0
                    • 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
                                          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