• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Anyone else trying to keep up with all the newish .NET stuff?

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    From that diagram I stopped following around 3.0... lambdas and LINQ can be very useful but I don't really like var and everything later is gibberish to me.
    Originally posted by MaryPoppins
    I'd still not breastfeed a nazi
    Originally posted by vetran
    Urine is quite nourishing

    Comment


      #12
      Originally posted by d000hg View Post
      From that diagram I stopped following around 3.0... lambdas and LINQ can be very useful but I don't really like var and everything later is gibberish to me.
      var is useful in a its usually x but occassionally could be y department.

      likewise optional parameters just keep the code a bit neater you don't end up with 5 functions for variations of input.
      merely at clientco for the entertainment

      Comment


        #13
        I use implicit var and linq/lambdas all the time. Rest of the gibberish, I wash my hands of it
        I am Brad. I do more than the needful and drive the market rates up by not bobbing my head.

        Comment


          #14
          Originally posted by eek View Post
          var is useful in a its usually x but occassionally could be y department.
          Isn't that what interfaces are for?

          likewise optional parameters just keep the code a bit neater you don't end up with 5 functions for variations of input.
          I suppose in C++ we already had part of that with default parameters, which never seemed to take on elsewhere. Though it wasn't a very elegant implementation... named+optional parameters I can see making sense.
          Originally posted by MaryPoppins
          I'd still not breastfeed a nazi
          Originally posted by vetran
          Urine is quite nourishing

          Comment


            #15
            Originally posted by d000hg View Post
            Isn't that what interfaces are for?

            I suppose in C++ we already had part of that with default parameters, which never seemed to take on elsewhere. Though it wasn't a very elegant implementation... named+optional parameters I can see making sense.
            var goes hand in hand with linq. It solves the issue where linq returns something that the programmer wasn't expecting.
            merely at clientco for the entertainment

            Comment


              #16
              If it returns something I wasn't expecting, I'd rather know about it than have things merrily go on doing something I hadn't planned on!
              Originally posted by MaryPoppins
              I'd still not breastfeed a nazi
              Originally posted by vetran
              Urine is quite nourishing

              Comment


                #17
                Originally posted by eek View Post
                var goes hand in hand with linq. It solves the issue where linq returns something that the programmer wasn't expecting.
                I think you might have misunderstood that.

                "var" was put there to handle anonymous types - as a programmer you should know what those look like because they are limited to the body of a method. If you want one of those to escape your method (outside of closures) you're just dealing with the "object" type again and are going to need to use reflection to get at its properties.

                I use "var" all the time too, do not see the need to mention the type twice when you're creating an object. I'm a bit more explicit with declarations when something is being returned from a method however.

                When you declare a variable with "var" you cant just change its type like you can with a dynamic language - it's fixed due to C#'s static typing.

                Comment


                  #18
                  Originally posted by Jaws View Post
                  I think you might have misunderstood that.

                  "var" was put there to handle anonymous types - as a programmer you should know what those look like because they are limited to the body of a method. If you want one of those to escape your method (outside of closures) you're just dealing with the "object" type again and are going to need to use reflection to get at its properties.

                  I use "var" all the time too, do not see the need to mention the type twice when you're creating an object. I'm a bit more explicit with declarations when something is being returned from a method however.

                  When you declare a variable with "var" you cant just change its type like you can with a dynamic language - it's fixed due to C#'s static typing.
                  Yes. To me, var means "I'm a lazy bugger. The compiler knows the type, the VS.NET knows the type, so why should I bother typing it in?"

                  Comment


                    #19
                    Another gem seen in some code today.

                    Code:
                    if (Enumerable.Range(0,100).Contains(x)) { // do stuff }
                    Checking if x >= 0 and <=100

                    Comment

                    Working...
                    X