Let me show you some code right away:
class MyClass {
public MyClass(Customer c) {
ExtractRoot(() => c.FirstName);
}
}
ExtractRoot is accepting a Expression<Func<object>> as its parameter.
I am trying to extract the customer object 'c' from the expression tree. I am passing it to the ExtractRoot method, and I know how to get the ConstantExpression which represents the customer object. But, when I call ToString() on that object I get this printed:
MyAssemblyName.CustomNamespace.MyClass+<>c__DisplayClass2
Can someone please explain what this means and why I am not getting my customer's ToString() method called, it is as if the object I am getting is not the customer, why and what am I getting back?
Finally, how can I get the actual customer object, or the root of my expression?