I'm not sure where you're going with this exactly, but to answer what you ask (and nothing more):
IQueryable queryable = ...
var methodCall = queryable.Expression as MethodCallExpression;
if(methodCall != null)
{
var method = methodCall.Method;
if(method.Name == "OfType" && method.DeclaringType == typeof(Queryable))
{
var type = method.GetGenericArguments().Single();
Console.WriteLine("OfType<{0}>", type);
}
}
Not sure how this highly specific bit of code is going to help you write your own query-provider, honestly. Could you expand a bit on your broader goals?