interface property copy in c#

后端 未结 8 2201
一生所求
一生所求 2021-02-07 08:13

I\'ve been working with C# for many years now, but just come across this issue that\'s stumping me, and I really don\'t even know how to ask the question, so, to the example!

8条回答
  •  北荒
    北荒 (楼主)
    2021-02-07 09:07

    You could have a constructor on each class taking an IAddress and have implemented members populated within.

    eg

    public WorkAddress(Iaddress address)
    {
        Line1 = IAddress.Line1;
        ...
    }
    

    For maintainability use reflection to get property names.

    HTH,

    Dan

提交回复
热议问题