My challenge for today was to get the value of generic typed properties from a generic type. Here is the code that worked.
pendingRequest is a generic-typed instance of RequestResponseAsyncResult where the Request and Response properties are generic.
First we have to get the generic type definition:
Type requestType = pendingRequest.GetType().GetGenericTypeDefinition();
Type[] typeArgs = requestType.GetGenericArguments();
Type genericType = typeof(RequestResponseAsyncResult<,>);
Type constructed = genericType.MakeGenericType(typeArgs);
PropertyInfo pireq = pendingRequest.GetType().GetProperty("Request");
PropertyInfo piresp = pendingRequest.GetType().GetProperty("Response");
object request = pireq.GetValue(pendingRequest, null);
object response = piresp.GetValue(pendingRequest, null);