Suppose I have two classes:
public class Student
{
public int Id {get; set;}
public string Name {get; set;}
public IList Courses{ g
FYI
When I was having the same question I found AutoMapper (http://automapper.codeplex.com/) Then after reading AboutDev's answer i was done some simple test, the results pretty impressive
here the test results:
Test Auto Mapper:22322 ms
Test Implicit Operator:310 ms
Test Property Copy:250 ms
Test Emit Mapper:281 ms
And i would like to underline that it is sample only with classes(StudentDTO, Student) which have only a couple of properties, but what would happened if classes would have 50 - 100 properties, i guess it will affect performance dramatically.
More tests details here: Object copy approaches in .net: Auto Mapper, Emit Mapper, Implicit Operation, Property Copy