System.Linq.QueryableTransformer.GetTargetDeclaringType C# (CSharp) Метод

GetTargetDeclaringType() статический приватный Метод

static private GetTargetDeclaringType ( MethodInfo method ) : Type
method System.Reflection.MethodInfo
Результат System.Type
		static Type GetTargetDeclaringType (MethodInfo method)
		{
			return method.DeclaringType == typeof (Queryable) ? typeof (Enumerable) : method.DeclaringType;
		}

Usage Example

        private static MethodInfo ReplaceQueryableMethod(MethodInfo method)
        {
            MethodInfo matchingMethod = QueryableTransformer.GetMatchingMethod(method, QueryableTransformer.GetTargetDeclaringType(method));

            if (matchingMethod != null)
            {
                return(matchingMethod);
            }
            throw new InvalidOperationException(string.Format("There is no method {0} on type {1} that matches the specified arguments", method.Name, method.DeclaringType.FullName));
        }