Convert in memory POCO objects to c# code to initialize

Posted by sidesinger on Stack Overflow See other posts from Stack Overflow or by sidesinger
Published on 2010-05-10T13:37:26Z Indexed on 2010/05/10 13:44 UTC
Read the original article Hit count: 348

Filed under:
|
|
|

Is there a library or code sample for converting an in memory POCO c# object to a .cs code file that creates that object. An example: object of type car in memory becomes:

Car c = new Car 
{ 
     Name = "mazda", 
     Id = 5,
     Passengers = new List<string> { "Bob", "Sally" }
     // etc... recursing to the bottom
};

I could assume it could only set public properties.

© Stack Overflow or respective owner

Related posts about c#

Related posts about serialization