public struct User {
public string Name;
public int Age;
public User(string name, int age) {
Name = name;
Age = age;
}
}
// ...
var user = new User("Ben", 31);
var birthdayBoy = user with { Age = user.Age + 1 };
Console.WriteLine(birthdayBoy.Name + " is now " + birthdayBoy.Age); // Prints "Ben is now 32"