I'm using anonymous types to pass collections of typed objects to a TemplateResolver, where the named placeholders in a newly instantiated text template may source values from multiple objects, e.g.
var body = TemplateResolver.ResolveTemplate(template.ExternalRecipientBody, new {Sender = customer, NewJobCard = jobCard});
where the template has placeholders like {Sender$Surname} and {NewJobCard$JobNumber}.
Inside ResolveTemplate I need Sender and NewJobCard to be strongly typed, without knowing what to cast them to.
SOLUTION SO FAR
I have come up with this so far, but dislike having to use a string member name. I have asked another question on the possibility of somehow lmbda'ring the string out of at least the method call, even if not the method body.
    private T GetAnonymousTypeMember<T>(object anonymousType, string memberName) where T: class 
    {
        var anonTypesType = anonymousType.GetType();
        var propInfo = anonTypesType.GetProperty(memberName);
        return propInfo.GetValue(anonymousType, null) as T;
    }