Eyal Solnik

My feedback

  1. 425 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      5 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
      Eyal Solnik supported this idea  · 
    • 15 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        0 comments  ·  Visual Studio IDE » Extensibility  ·  Flag idea as inappropriate…  ·  Admin →
        Eyal Solnik shared this idea  · 
      • 1 vote
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          0 comments  ·  Visual Studio IDE » Install  ·  Flag idea as inappropriate…  ·  Admin →
          Eyal Solnik shared this idea  · 
        • 38 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            3 comments  ·  Visual Studio IDE » IDE and Editor  ·  Flag idea as inappropriate…  ·  Admin →
            Eyal Solnik commented  · 

            If I had votes I'd upvote this suggestion but yeah please add it! I have a C# project where some items in the project shouldn't be visible because they just some dummy files filled with data but they still need to be included.

          • 3,224 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              34 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
              Eyal Solnik supported this idea  · 
              Eyal Solnik commented  · 

              @Mark Seemann, I'd argue that coupling has to happen somewhere! and it's actually a job of the developer to decide where it happens.

              It's funny how some developers think sometimes, soon developers will think that their objects need to float in the air and have zero coupling which obviously promotes something else, abstractions and complexity.

              p.s. I understand the rational but I hate it when people just trash principles and make many of them an anti-pattern without a real world context WHEN it's actually can be useful to solve a problem, in fact, many anti-patterns might be considered as such because developers tend to abuse and overuse principles and think that there's a silver bullet to all problems.

              Soon we won't have any principles because all of them will be considered an anti-pattern.

            • 354 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                I agree to the terms of service
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                53 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
                Eyal Solnik commented  · 

                @Anonymous, I understand, well hopefully they will get it right! ;)

                Eyal Solnik commented  · 

                @Anonymous, the TryParse method is a pattern that answers a specific problem and you can't just use it just because... in fact this pattern require a benchmark test to even make it viable so you can't just add Try to a method because you feel like it.

                Maybe the OP didn't give the best example in the world or the syntax is not quite your taste but the point is that it can be helpful in many situations.

                Like I said in my own post I don't really like this syntax either so I wrote another post that to me seems more natural.

                Eyal Solnik commented  · 

                @Anonymous, if you don't like it then don't use it.

                It has nothing with being lazy it has a lot with maintaining the code and make it more readable, out and ref were never meant do use them in the way you're using them so make sure you know your stuff before going all out and saying that it's laziness.

                Many other languages has this feature and it works there why wouldn't it work here?

                Eyal Solnik commented  · 

                @Anonymous, you don't disregard the return type, the return type is still an actual type!

                When you return an object initializer the compiler creates an anonymous class, so it's far from being a scripting language, there's still a type.

                When you use LINQ and you return an object initializer you MUST use the var keyword to access the anonymous object so my suggestion goes hand in hand with this.

                It has nothing to do with readability in fact having a var on the function can tell you that it returns an anonymous type.

                Another key point in my suggestion is that it removes completely the need for unnamed Tuples and it also play nicely with LINQ and Task based async.

                My first suggestion before I thought of var was using interfaces like so.

                interface IPoint2D
                {
                int X { get; set; };
                int Y { get; set; };
                }

                public IPoint2D GetPoint2D()
                {
                return new { X = 1, Y = 2 };
                }

                IPoint2D point = GetPoint2D();

                However, using var still gives you the static safety that you need/want, it just removes completely the requirement to define the type for the return values, instead it delegates the work to the compiler and tells the compiler to generate the type based on the returned values.

                It's believed by some that the var keyword works like var in JavaScript or other dynamic languages whereas in fact it doesn't, it's completely static in nature.

                I'm part of the "don't overuse it" crowd but when you need an access to object initializer, the few option you have is using var, object or dynamic, two of them you can return from a function but you cannot do that with var because it plays differently, it's not a type in itself, if we had this option I doubt that we were here asking for an alternative.

                Not to mention that reusing a language feature that one of the reasons for its existence is to give you an access to the underlying anonymous type of an object initializer is far better than introducing yet another syntax.

                The use of interfaces and defining the return types on the function is counterintuitive.

                Eyal Solnik commented  · 

                I proposed a similar approach that takes advantage of Object Initializers and the var keyword, you can have a look at it here http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6348329-returning-multiple-values

                The problems with Tuples is that you can't really expose them in your public APIs, the properties are unnamed, make few of these and soon enough you will run into maintainability problem.

                out/ref was never made for returning multiple values but to PASS things by reference! yes you can abuse it but it's not really a solution.

              • 959 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  I agree to the terms of service
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  17 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
                  Eyal Solnik supported this idea  · 
                • 5,399 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    I agree to the terms of service
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    93 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
                    Eyal Solnik supported this idea  · 

                  Feedback and Knowledge Base