I have two object of class Book. It is possible merge two objects overriding null values?
Book model:
public string Author {get; set}
public string Title {get; set}
public string EAN {get; set}
First Book data:
Book.Author -> "Adam Wróbel"
Book.Title -> "StackOverflow Book"
Book.EAN-> "777777777"
Second Book data:
Book.Author -> null
Book.Title -> "StackOverflow Book v2"
Book.EAN-> null
Is it possible to combine these two objects in such a way that I get the result like this?
Book.Author -> "Adam Wróbel" (data from first book)
Book.Title -> "StackOverflow Book v2" (data from second book)
Book.EAN-> "777777777" (data from first book)
P.S. I know that I can compare each of these fields by checking if statements are not null and assign to the other object. However, this seems to be a fairly limited way to solve this problem.