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. Other Discussions
  3. The Weird and The Wonderful
  4. How about this little c# code

How about this little c# code

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpquestion
12 Posts 7 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.
  • T Offline
    T Offline
    t bast
    wrote on last edited by
    #1

    ((Func<int?, int?>)(x => ++x))(default(int));

    :doh:

    L B A 3 Replies Last reply
    0
    • T t bast

      ((Func<int?, int?>)(x => ++x))(default(int));

      :doh:

      L Offline
      L Offline
      Lutoslaw
      wrote on last edited by
      #2

      ((Func)(x => ++x))(default(int));

      Can 0 be casted to a function delegate? Also, is "++x" legal if x is nullable? Weird.

      Greetings - Jacek

      S 1 Reply Last reply
      0
      • T t bast

        ((Func<int?, int?>)(x => ++x))(default(int));

        :doh:

        B Offline
        B Offline
        Brisingr Aerowing
        wrote on last edited by
        #3

        :doh:

        brisingr_aerowing@Gryphon-PC $ rake in_the_dough Raking in the dough brisingr_aerowing@Gryphon-PC $ make lots_of_money Making lots_of_money

        1 Reply Last reply
        0
        • L Lutoslaw

          ((Func)(x => ++x))(default(int));

          Can 0 be casted to a function delegate? Also, is "++x" legal if x is nullable? Weird.

          Greetings - Jacek

          S Offline
          S Offline
          Sentenryu
          wrote on last edited by
          #4

          read the parenthesis, it is clearer this way:

          var f = (Func)(x => ++x);
          f(default(int));

          it's pointless code, but it works.

          I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

          N 1 Reply Last reply
          0
          • S Sentenryu

            read the parenthesis, it is clearer this way:

            var f = (Func)(x => ++x);
            f(default(int));

            it's pointless code, but it works.

            I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

            N Offline
            N Offline
            Nicholas Marty
            wrote on last edited by
            #5

            so basically all this expression does is return a nullable int with the value "1"? :doh:

            S 1 Reply Last reply
            0
            • N Nicholas Marty

              so basically all this expression does is return a nullable int with the value "1"? :doh:

              S Offline
              S Offline
              Sentenryu
              wrote on last edited by
              #6

              yep, that's why i said it's pointless, it's probably test code someone forgot to erase, at least i hope so.

              I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

              M 1 Reply Last reply
              0
              • T t bast

                ((Func<int?, int?>)(x => ++x))(default(int));

                :doh:

                A Offline
                A Offline
                Argonia
                wrote on last edited by
                #7

                This function plays the role of rand() :laugh: Proof

                Microsoft ... the only place where VARIANT_TRUE != true

                1 Reply Last reply
                0
                • S Sentenryu

                  yep, that's why i said it's pointless, it's probably test code someone forgot to erase, at least i hope so.

                  I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

                  M Offline
                  M Offline
                  MarkRHolbrook
                  wrote on last edited by
                  #8

                  We got a lot of them there types of function in the current project I'm tryin to untangle. I think the previous contract company lived under the motto: 200 lines of code per programmer per day keeps the customer fat, dumb, happy, and *away*

                  S 1 Reply Last reply
                  0
                  • M MarkRHolbrook

                    We got a lot of them there types of function in the current project I'm tryin to untangle. I think the previous contract company lived under the motto: 200 lines of code per programmer per day keeps the customer fat, dumb, happy, and *away*

                    S Offline
                    S Offline
                    Sentenryu
                    wrote on last edited by
                    #9

                    Here we use the Go Horse methodology, so we also have loads of entangled code that no one is capable of understanding, that is actually good code if compared to what we have here :(

                    I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

                    M 1 Reply Last reply
                    0
                    • S Sentenryu

                      Here we use the Go Horse methodology, so we also have loads of entangled code that no one is capable of understanding, that is actually good code if compared to what we have here :(

                      I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

                      M Offline
                      M Offline
                      MarkRHolbrook
                      wrote on last edited by
                      #10

                      In addition to the 200 lines per day per programmer I think they also enforced just about every current buzz programming word and paradigm. I'd say they succeeded in folling the SOLID principles just fine. :laugh: Edit: Auto correct sux... WTF is "folling"? Urban dictionary says I've lapsed into urban slang... sigh...

                      S B 2 Replies Last reply
                      0
                      • M MarkRHolbrook

                        In addition to the 200 lines per day per programmer I think they also enforced just about every current buzz programming word and paradigm. I'd say they succeeded in folling the SOLID principles just fine. :laugh: Edit: Auto correct sux... WTF is "folling"? Urban dictionary says I've lapsed into urban slang... sigh...

                        S Offline
                        S Offline
                        Sentenryu
                        wrote on last edited by
                        #11

                        No one from the "teams" that wrote our legacy software works here anymore, but i don't think they even know that SOLID is an acronym

                        I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

                        1 Reply Last reply
                        0
                        • M MarkRHolbrook

                          In addition to the 200 lines per day per programmer I think they also enforced just about every current buzz programming word and paradigm. I'd say they succeeded in folling the SOLID principles just fine. :laugh: Edit: Auto correct sux... WTF is "folling"? Urban dictionary says I've lapsed into urban slang... sigh...

                          B Offline
                          B Offline
                          Brisingr Aerowing
                          wrote on last edited by
                          #12

                          You need this![^]

                          Keep Clam And Proofread -- √(-1) 23 ∑ π... And it was delicious.

                          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