I have two objects and I want to merge them:
public class Foo
{
public string Name { get; set; }
}
public class Bar
{
public Guid Id { get; set; }
p
If you can add a method to the metadata class you could do something like the following
public class Foo
{
public string Name { get; set; }
public void SerializeWithMetadata(Bar bar)
{
var obj = new {
Name = this.Name,
Guid = bar.Guid,
Property1 = Bar.Property1
}
//Serialization code goes here
}
}
public class Bar
{
public Guid Id { get; set; }
public string Property1 { get; set; }
public string Property2 { get; set; }
public string Property3 { get; set; }
public string Property4 { get; set; }
}
I'm not sure I would recommend this exact approach I mainly left it here to display anonymous types as a possible option that might be worth exploring