Easy Instantiation RRS feed

  • Question

  • User993279834 posted

    Does anyone know of a libary , extension etc which would enable me to instantiate one object from another without going through the pain of manually assigning each property.  With todays seperation this seems like an all too frequent excercise.

    So something like where you pass in the type you want instantiated and another object containing the same fieldname and have a newly instaniated object returned of type T

    Return T Inject( T, TDataObject )


    Tuesday, August 6, 2013 4:09 AM


All replies

  • User-760709272 posted

    If you google for "c# object mapping" or object mapping framework, there are quite a few out there.

    Tuesday, August 6, 2013 4:18 AM
  • User-1910946339 posted

    Use AutoMapper http://automapper.org/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 6, 2013 6:05 PM