I suggest you ...

return void, returnif, returnsame, break on

return [void operation]; - One line returns
returnif [boolean operation]; - Returns if operation is true
public int MyProperty { get; returnsame set; } - Doesn't set the value if it equals the current value.
break [operation]; - Shorter breaks

Example code:

public WindowStyle Style { get; returnsame set; }

public void DoSomething()
{
if (something)
return Something();
}

returnif myVar;

public void Check(int var)
{
if (var == 0)
break doSomething();
// something else
}

For better example view and all my suggestions visit http://www.jsmars.com/csharp.php

2 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Jonathan Smårs shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Philippe commented  ·   ·  Flag as inappropriate

        Being able to return void is useless except in generic code... but then void would have to be supported as a type in those cases. And given how generic code works and related restriction, I do not think that it would be possible without major changes. And then at that point, there would be many more features that would be much more useful than that.

        For other proposed keyword, it is hard to understand either what they do or what would be the advantage as it does increase the language complexity with marginal benefit if any.

      Feedback and Knowledge Base