Hacker News new | past | comments | ask | show | jobs | submit login

Although with c# 6.0 (current release) you can simplify that to:

  public class Complex {
    public double I { get; } 
    public double J { get; }
    public Complex(double i, double j) {
      I = i;
      J = j;
    }
  }



Even before C# 6.0, you could simplify it this way:

  public class Complex {
    public double I { get; private set; } 
    public double J { get; private set; }
    public Complex(double i, double j) {
      I = i;
      J = j;
    }
  }




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: