How to copy value from class X to class Y with the same property name in c#?

后端 未结 5 755
灰色年华
灰色年华 2020-11-28 08:49

Suppose I have two classes:

public class Student
{
    public int Id {get; set;}
    public string Name {get; set;}
    public IList Courses{ g         


        
5条回答
  •  爱一瞬间的悲伤
    2020-11-28 09:24

    There's a library for doing just that - http://emitmapper.codeplex.com/

    It's much faster than AutoMapper, it uses System.Reflection.Emit, so the code runs almost as fast as if it was hand-written.

提交回复
热议问题