interface property copy in c#

后端 未结 8 2204
一生所求
一生所求 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 08:59

    You would need to create a method to do this

    public void CopyFrom(IAddress source)
    {
        this.Address1 = source.Address1;
        this.Address2 = source.Address2;
        this.City = source.city;
    }
    

提交回复
热议问题