News for hackers. Stuff that matters.
Re:New Features in C# 7.0 by louthy on Thursday March 09, 2017 @11:59PM (#13836504)
> here's nothing preventing the method call from mutating it.

There is, the class could be immutable.

    public class Vector
    {
        public readonly int X;
        public readonly int Y;

        public Vector(int x, int y) 
        {
            X = x;
            Y = y;
        }

        public Vector With(int? X = null, int? Y = null) =>
            new Vector(X ?? this.X, Y ?? this.Y);
    }
I believe record-types are proposed for the next release of C#.
Re:New Features in C# 7.0 by benaadams on Friday March 10, 2017 @04:41AM (#13837446)
Mutable class with immutable struct wrapper would be better on allocations; then pass in the struct wrapper.