-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
모델의 특정 속성 혹은 속성들의 값을 변경한 개정 인스턴스를 생성하는 작업을 도와주는 확장 메서드 집합을 제공합니다. 아래 코드를 참고하세요.
public User
{
public User(Guid id, string userName, string email, string bio)
{
Id = id;
UserName = userName;
Email = email;
Bio = bio;
}
public Guid Id { get; }
public string UserName { get; }
public string Email { get; }
public string Bio { get; }
}
var user = new User(
Guid.NewGuid(),
"Obiwan Kenobi",
"[email protected]",
"Jedi master");
User revision1 = user.ReviseWith(x => x.Email, "[email protected]");
User revision2 = revision1
.Revise()
.With(x => x.UserName, "Ben Kenobi")
.With(x => x.Bio, "The Force will be with you, always.");