Seeing as I have to search for this code snippet on most occasions that I use it, I’ve decided to put it here as a post. I often find that I have to repeat the same code over and over when converting between two similar types (e.g. Person domain object and PersonDto object). If you see something like this crop up too often: var personDto = new PersonDto
{
Id = person.Id,
FirstName = person.FirstName,
LastName = person.LastName,
Age = person.Age
};
You have two options: 1)...