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. Strange? C# made easy with java

Strange? C# made easy with java

Scheduled Pinned Locked Moved The Lounge
csharpjavatutorialquestion
19 Posts 11 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.
  • D Dgmarious

    Seriously. Somethings in C# seems more understandable to me with java example. But... I am not that Java guy.

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

    Can you elaborate on this, this is honestly the first time I've heard something like this. Do you have any examples?

    S 1 Reply Last reply
    0
    • L Lost User

      Can you elaborate on this, this is honestly the first time I've heard something like this. Do you have any examples?

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #3

      Witness the following C# piece of code:

      var x = 0;
      x = x++;

      What does this even means? How could x be equal to x++? It's obviously different! Well now imagine the following Java code

      int x = 0;
      x = x++;

      Now imagine the C# is, in fact, doing the same thing! Bazongas! The value of x is so obvious now! Obviously 1 or 0! :-o

      A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

      L G 2 Replies Last reply
      0
      • D Dgmarious

        Seriously. Somethings in C# seems more understandable to me with java example. But... I am not that Java guy.

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

        Perhaps it is because you don't know how to program in C#?

        D 1 Reply Last reply
        0
        • S Super Lloyd

          Witness the following C# piece of code:

          var x = 0;
          x = x++;

          What does this even means? How could x be equal to x++? It's obviously different! Well now imagine the following Java code

          int x = 0;
          x = x++;

          Now imagine the C# is, in fact, doing the same thing! Bazongas! The value of x is so obvious now! Obviously 1 or 0! :-o

          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

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

          The equivalent of that code in C# would also be using an "int". Exactly like below;

          int x = 0;
          x = x++;

          ..which IS your java-example. The "var" keyword is not meant to be used as a replacement for int, and anyone doing so should stop coding. It clearly has a joke icon.

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          1 Reply Last reply
          0
          • D Dgmarious

            Seriously. Somethings in C# seems more understandable to me with java example. But... I am not that Java guy.

            C Offline
            C Offline
            CodeWraith
            wrote on last edited by
            #6

            Dgmarious wrote:

            But... I am not that Java guy.

            That's good. Most of the Java guys I met were fanatics, as if the language had been invented as part of a clever plan by Scientology.

            I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.

            M 1 Reply Last reply
            0
            • S Slacker007

              Perhaps it is because you don't know how to program in C#?

              D Offline
              D Offline
              Dgmarious
              wrote on last edited by
              #7

              hmmm. maybe though. But I guess I have some level of proficiency in C# and have being doing some real complex stuffs... But for once I came across need for Data-flow (Producer consumer pattern with BlockingCollection) I found an example of BlockingQueue in java very handy and translate to c#.

              N 1 Reply Last reply
              0
              • D Dgmarious

                Seriously. Somethings in C# seems more understandable to me with java example. But... I am not that Java guy.

                R Offline
                R Offline
                realJSOP
                wrote on last edited by
                #8

                Essentially, if you know Java, then you're basically familiar with C#. Even a lot of the class names are the same.

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

                D 1 Reply Last reply
                0
                • C CodeWraith

                  Dgmarious wrote:

                  But... I am not that Java guy.

                  That's good. Most of the Java guys I met were fanatics, as if the language had been invented as part of a clever plan by Scientology.

                  I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.

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

                  CodeWraith wrote:

                  Most of the Java guys I met were fanatics

                  I encountered that 25 years ago. Gads, is it still true today, or did they all become Ruby fanatics? ;)

                  Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  C 1 Reply Last reply
                  0
                  • D Dgmarious

                    Seriously. Somethings in C# seems more understandable to me with java example. But... I am not that Java guy.

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

                    As your other post eluded to, yeah, Java loves its patterns, and sometimes there's a gem in some Java example. On the other hand, the reason Java loves its patterns so much is that doing complex things in Java is so much more of a PITA.

                    Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      CodeWraith wrote:

                      Most of the Java guys I met were fanatics

                      I encountered that 25 years ago. Gads, is it still true today, or did they all become Ruby fanatics? ;)

                      Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                      C Offline
                      C Offline
                      CodeWraith
                      wrote on last edited by
                      #11

                      At least those that tried to assimilate me about four years ago still were.

                      I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.

                      1 Reply Last reply
                      0
                      • D Dgmarious

                        hmmm. maybe though. But I guess I have some level of proficiency in C# and have being doing some real complex stuffs... But for once I came across need for Data-flow (Producer consumer pattern with BlockingCollection) I found an example of BlockingQueue in java very handy and translate to c#.

                        N Offline
                        N Offline
                        Nathan Minier
                        wrote on last edited by
                        #12

                        Have a look at the [TPL Dataflow](https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/dataflow-task-parallel-library) library. It's stupid easy and does the job nicely without needing any of that mungy blocking.

                        "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

                        1 Reply Last reply
                        0
                        • S Super Lloyd

                          Witness the following C# piece of code:

                          var x = 0;
                          x = x++;

                          What does this even means? How could x be equal to x++? It's obviously different! Well now imagine the following Java code

                          int x = 0;
                          x = x++;

                          Now imagine the C# is, in fact, doing the same thing! Bazongas! The value of x is so obvious now! Obviously 1 or 0! :-o

                          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                          G Offline
                          G Offline
                          GuyThiebaut
                          wrote on last edited by
                          #13

                          Super Lloyd wrote:

                          int x = 0; x = x++;

                          I knew that this was going to result in x being 1, so to confirm I tested it and yes as I knew it results in x being 0. It's a nasty little b*gger that one and I hope I never come across it in code.

                          “That which can be asserted without evidence, can be dismissed without evidence.”

                          ― Christopher Hitchens

                          L 1 Reply Last reply
                          0
                          • R realJSOP

                            Essentially, if you know Java, then you're basically familiar with C#. Even a lot of the class names are the same.

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

                            D Offline
                            D Offline
                            Dgmarious
                            wrote on last edited by
                            #14

                            I agree with you

                            1 Reply Last reply
                            0
                            • G GuyThiebaut

                              Super Lloyd wrote:

                              int x = 0; x = x++;

                              I knew that this was going to result in x being 1, so to confirm I tested it and yes as I knew it results in x being 0. It's a nasty little b*gger that one and I hope I never come across it in code.

                              “That which can be asserted without evidence, can be dismissed without evidence.”

                              ― Christopher Hitchens

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

                              GuyThiebaut wrote:

                              It's a nasty little b*gger that one and I hope I never come across it in code.

                              I dunno, seen a few juniors doing just that, also other juniors that told them to stop as it might cause an endless loop. :sigh: When that comes out it's time for a coffee - away from the office.

                              Format Succe&*(gD@@@:beer:@@@@@@*@x@@

                              L 1 Reply Last reply
                              0
                              • L Lost User

                                GuyThiebaut wrote:

                                It's a nasty little b*gger that one and I hope I never come across it in code.

                                I dunno, seen a few juniors doing just that, also other juniors that told them to stop as it might cause an endless loop. :sigh: When that comes out it's time for a coffee - away from the office.

                                Format Succe&*(gD@@@:beer:@@@@@@*@x@@

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

                                Confiscate their coding licenses.

                                D 1 Reply Last reply
                                0
                                • L Lost User

                                  Confiscate their coding licenses.

                                  D Offline
                                  D Offline
                                  Daniel Pfeffer
                                  wrote on last edited by
                                  #17

                                  harold aptroot wrote:

                                  Confiscate their coding licenses

                                  You are much too lenient. That sort of blunder calls for staking out on an anthill, at the very least! :mad:

                                  If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

                                  J 1 Reply Last reply
                                  0
                                  • D Daniel Pfeffer

                                    harold aptroot wrote:

                                    Confiscate their coding licenses

                                    You are much too lenient. That sort of blunder calls for staking out on an anthill, at the very least! :mad:

                                    If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

                                    J Offline
                                    J Offline
                                    Jorgen Andersson
                                    wrote on last edited by
                                    #18

                                    Time to call the RSPCA

                                    Wrong is evil and must be defeated. - Jeff Ello

                                    D 1 Reply Last reply
                                    0
                                    • J Jorgen Andersson

                                      Time to call the RSPCA

                                      Wrong is evil and must be defeated. - Jeff Ello

                                      D Offline
                                      D Offline
                                      Daniel Pfeffer
                                      wrote on last edited by
                                      #19

                                      Jörgen Andersson wrote:

                                      RSPCA

                                      The Royal Society for the Prevention of Cruelty to Ants? :)

                                      If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

                                      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