What is the best way to merge two objects during runtime using C#?

后端 未结 7 519
野的像风
野的像风 2021-02-06 10:18

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         


        
7条回答
  •  北恋
    北恋 (楼主)
    2021-02-06 11:12

    If you don't mind them being grouped rather than merged:

    public class FooEx
    {
        public Foo Foo { get; set; }
        public T Ex { get; set; }
    }
    

提交回复
热议问题