This project is read-only.

From class without constructor to class with constructor

Feb 5, 2013 at 6:22 PM
How is glue used to go from a class without a constructor to a class with a constructor?

class A { public string Name{ get; set; } }
class B { public string Name{ get; private set; } public B(string name){ Name = name; } }
Feb 5, 2013 at 11:31 PM
Edited Feb 5, 2013 at 11:32 PM
Found it in the code:
public Mapping(Func<RightType, LeftType> leftTypeCreator, Func<LeftType, RightType> rightTypeCreator)
Which allows this:
var mapping = new Mapping(b => new ClassA(), a => new ClassB(a.Name));
Nice and simple!
Feb 6, 2013 at 6:52 PM
There you go! Thank you!