-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
What I really want is something like F# records. Those a helpful feature called Copy and Update Expressions:
type Person = {
FirstName: string
LastName: string
Email: string
}
let person = { FirstName = "first"; LastName = "last"; Email = "email" }
let updatedEmail = { person with Email = "newEmail" } // Copy and Update Expression
Will be nice to create extension method based on deepcopier that will copy and override values like this:
class Person
{
public string FirstName { get; }
public string LastName { get; }
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
}
var person = new Person("bob", "jonhs");
var person2 = person.Update({ FirstName = "michael" });
var person3 = person.Update(p => p.FirstName, "michael");Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels