I suggest you ...

Add operation to automatic property set;

Auto properties can have one line additions to set, making a function call or one operation possible.

Suggested Syntax:
public int Something { get; set; } += doSomething();

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

        You almost want to do the same thing in get and set and when you do something, it might be conditional (if the value was changed/initialized) or it might be useful to know the old value.

        By the way in C# 7, you can now use => for get/set so you can reduce code for trivial cases.

      Feedback and Knowledge Base