Reuse Translation Masks
[[Translation Masks]] are a powerful toolset that give you fine-grained control over things like a Copy or Equality check.
They typically look like this:
var bookCopy = book.DeepCopy(new Book.TranslationMask(defaultOn: true)
{
PickUpSound = false,
PutDownSound = false,
});
PickUpSound
and PutDownSound
and leave them on their default values.
However, code like the ones above are typically done in loops:
foreach (var book in books)
{
var bookCopy = book.DeepCopy(new Book.TranslationMask(defaultOn: true)
{
PickUpSound = false,
PutDownSound = false,
});
}
A TranslationMask is just instructions for what to copy, so they can be reused. A better way would look like this:
var bookCopyMask = new Book.TranslationMask(defaultOn: true)
{
PickUpSound = false,
PutDownSound = false,
};
foreach (var book in books)
{
var bookCopy = book.DeepCopy(bookCopyMask);
}