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. Is it challenging, or is it easy?

Is it challenging, or is it easy?

Scheduled Pinned Locked Moved The Lounge
tutorialcsharprubycomquestion
16 Posts 14 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.
  • M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #1

    Found this gem:

    Quote:

    Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

    OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

    enum DifferentType {
    long WeInt = 1,
    short creat = 2.345
    }

    That leaves me speechless. It's broken and borked on so many levels. :wtf:

    Latest Articles:
    Microservices: Myth, Madness, or Magic I Take Exception

    J P F realJSOPR M 10 Replies Last reply
    0
    • M Marc Clifton

      Found this gem:

      Quote:

      Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

      OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

      enum DifferentType {
      long WeInt = 1,
      short creat = 2.345
      }

      That leaves me speechless. It's broken and borked on so many levels. :wtf:

      Latest Articles:
      Microservices: Myth, Madness, or Magic I Take Exception

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #2

      Quote:

      Challenging or easy

      How about both?....Cheasy. :)

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      1 Reply Last reply
      0
      • M Marc Clifton

        Found this gem:

        Quote:

        Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

        OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

        enum DifferentType {
        long WeInt = 1,
        short creat = 2.345
        }

        That leaves me speechless. It's broken and borked on so many levels. :wtf:

        Latest Articles:
        Microservices: Myth, Madness, or Magic I Take Exception

        P Offline
        P Offline
        PeejayAdams
        wrote on last edited by
        #3

        Marc Clifton most definitely did NOT write:

        enum DifferentType { long WeInt = 1, short creat = 2.345 }

        I think I'm getting it ... Yep, it's 7-letters, the first one's an 'S', it definitely ends in "UM" ... (apologies to anyone who doesn't follow the CCC threads)

        Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain

        L 1 Reply Last reply
        0
        • M Marc Clifton

          Found this gem:

          Quote:

          Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

          OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

          enum DifferentType {
          long WeInt = 1,
          short creat = 2.345
          }

          That leaves me speechless. It's broken and borked on so many levels. :wtf:

          Latest Articles:
          Microservices: Myth, Madness, or Magic I Take Exception

          F Offline
          F Offline
          Forogar
          wrote on last edited by
          #4

          That is broken for sure - although technically not. However, it does make me think why don't we just use a readonly, const, static, whatever, class full of values as they (sort of) show in a later example instead of an enum? ...and no casting required. Is it really much of a performance hit, if any?

          - I would love to change the world, but they won’t give me the source code.

          1 Reply Last reply
          0
          • M Marc Clifton

            Found this gem:

            Quote:

            Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

            OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

            enum DifferentType {
            long WeInt = 1,
            short creat = 2.345
            }

            That leaves me speechless. It's broken and borked on so many levels. :wtf:

            Latest Articles:
            Microservices: Myth, Madness, or Magic I Take Exception

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #5

            Well, that enum is just wrong. Will that even compile?

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

            L M 2 Replies Last reply
            0
            • realJSOPR realJSOP

              Well, that enum is just wrong. Will that even compile?

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

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

              #realJSOP wrote:

              Will that even compile?

              therein lies the challenging part

              Message Signature (Click to edit ->)

              1 Reply Last reply
              0
              • M Marc Clifton

                Found this gem:

                Quote:

                Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

                OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

                enum DifferentType {
                long WeInt = 1,
                short creat = 2.345
                }

                That leaves me speechless. It's broken and borked on so many levels. :wtf:

                Latest Articles:
                Microservices: Myth, Madness, or Magic I Take Exception

                M Offline
                M Offline
                Mark_Wallace
                wrote on last edited by
                #7

                By unhappy coincidence, I've just finished writing a section for a style guide that tells people never to say that something is difficult, challenging, complicated, etc. -- because, if you do, people will believe it, and it will become a self-fulfilling prophecy.

                Marc Clifton most certainly did not write:

                enum DifferentType {
                long WeInt = 1,
                short creat = 2.345}

                Well, at least they've proven that they can count up to five -- but not much else.

                I wanna be a eunuchs developer! Pass me a bread knife!

                1 Reply Last reply
                0
                • M Marc Clifton

                  Found this gem:

                  Quote:

                  Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

                  OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

                  enum DifferentType {
                  long WeInt = 1,
                  short creat = 2.345
                  }

                  That leaves me speechless. It's broken and borked on so many levels. :wtf:

                  Latest Articles:
                  Microservices: Myth, Madness, or Magic I Take Exception

                  G Offline
                  G Offline
                  GKP1992
                  wrote on last edited by
                  #8

                  This is the side effect of "You must use enums for comparisons so that the code is maintainable." code review comments.

                  M 1 Reply Last reply
                  0
                  • M Marc Clifton

                    Found this gem:

                    Quote:

                    Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

                    OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

                    enum DifferentType {
                    long WeInt = 1,
                    short creat = 2.345
                    }

                    That leaves me speechless. It's broken and borked on so many levels. :wtf:

                    Latest Articles:
                    Microservices: Myth, Madness, or Magic I Take Exception

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

                    It's easy. Unless you're doing it wrong, in which case it's challenging.

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      Found this gem:

                      Quote:

                      Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

                      OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

                      enum DifferentType {
                      long WeInt = 1,
                      short creat = 2.345
                      }

                      That leaves me speechless. It's broken and borked on so many levels. :wtf:

                      Latest Articles:
                      Microservices: Myth, Madness, or Magic I Take Exception

                      Mike HankeyM Offline
                      Mike HankeyM Offline
                      Mike Hankey
                      wrote on last edited by
                      #10

                      Wow... and with a slogan of "Take your skills to the next level" I'm just wondering what level they speak of?

                      Technician 1. A person that fixes stuff you can't. 2. One who does precision guesswork based on unreliable data provided by those of questionable knowledge. JaxCoder.com

                      R 1 Reply Last reply
                      0
                      • realJSOPR realJSOP

                        Well, that enum is just wrong. Will that even compile?

                        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                        -----
                        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                        -----
                        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

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

                        #realJSOP wrote:

                        Will that even compile?

                        Hell no. Not now, not in 2016 when that post was written.

                        Latest Articles:
                        Microservices: Myth, Madness, or Magic I Take Exception

                        1 Reply Last reply
                        0
                        • M Marc Clifton

                          Found this gem:

                          Quote:

                          Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

                          OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

                          enum DifferentType {
                          long WeInt = 1,
                          short creat = 2.345
                          }

                          That leaves me speechless. It's broken and borked on so many levels. :wtf:

                          Latest Articles:
                          Microservices: Myth, Madness, or Magic I Take Exception

                          D Offline
                          D Offline
                          Dan Neely
                          wrote on last edited by
                          #12

                          Probably the best part of that sewage backup posing as an article, is the single nonsequiter of a comment at the end.                                                                                             X| X| X| X| X|                         X| X| X| X| X| X|                             X| X| X| X| X| X| X| X| X|               X| X|                             X| X|                X| X| X| X| X| X| X| X| X| X| X| X|           X|                                                X|      X| X| X| X| X| X| X| X| X| X| X| X| X| X|      X|                                                     X| X| X| X| X| X| X| X| X| X| X| X| X| X| X| X| X|      X|               X|      X|                   X| X| X| X| X| X|    &n

                          1 Reply Last reply
                          0
                          • Mike HankeyM Mike Hankey

                            Wow... and with a slogan of "Take your skills to the next level" I'm just wondering what level they speak of?

                            Technician 1. A person that fixes stuff you can't. 2. One who does precision guesswork based on unreliable data provided by those of questionable knowledge. JaxCoder.com

                            R Offline
                            R Offline
                            ronlease
                            wrote on last edited by
                            #13

                            I think they're talking about level 4 (by Dante's reckoning).

                            1 Reply Last reply
                            0
                            • P PeejayAdams

                              Marc Clifton most definitely did NOT write:

                              enum DifferentType { long WeInt = 1, short creat = 2.345 }

                              I think I'm getting it ... Yep, it's 7-letters, the first one's an 'S', it definitely ends in "UM" ... (apologies to anyone who doesn't follow the CCC threads)

                              Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain

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

                              PeejayAdams wrote:

                              I think I'm getting it ... Yep, it's 7-letters, the first one's an 'S', it definitely ends in "UM" ... (apologies to anyone who doesn't follow the CCC threads)

                              ...and loving it.

                              Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                              1 Reply Last reply
                              0
                              • G GKP1992

                                This is the side effect of "You must use enums for comparisons so that the code is maintainable." code review comments.

                                M Offline
                                M Offline
                                Munchies_Matt
                                wrote on last edited by
                                #15

                                I hate this kind of dogmatic crap. What the hell is wrong with a define, in upper case for comparisons?

                                1 Reply Last reply
                                0
                                • M Marc Clifton

                                  Found this gem:

                                  Quote:

                                  Getting an int value from enum can be challenging in C#. However, it can easily be done by using the following code:

                                  OK, which is it? Challenging or easy? And a horrid discussion of why it can be challenging continues on Learn C# - How To Get Int Value from Enum[^] with this code example:

                                  enum DifferentType {
                                  long WeInt = 1,
                                  short creat = 2.345
                                  }

                                  That leaves me speechless. It's broken and borked on so many levels. :wtf:

                                  Latest Articles:
                                  Microservices: Myth, Madness, or Magic I Take Exception

                                  D Offline
                                  D Offline
                                  Dr Walt Fair PE
                                  wrote on last edited by
                                  #16

                                  OMG, code in the Lounge, will the un go dark next? Isn't Ord(MyEnumVar) easier?

                                  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