System.Linq.Dynamic.ExpressionParser.FindGenericType C# (CSharp) Method

FindGenericType() private static method

private static FindGenericType ( Type generic, Type type ) : Type
generic System.Type
type System.Type
return System.Type
		private static Type FindGenericType(Type generic, Type type)
		{
			while (type != null && type != typeof(object))
			{
				if (type.IsGenericType && type.GetGenericTypeDefinition() == generic) return type;
				if (generic.IsInterface)
				{
					foreach (Type intfType in type.GetInterfaces())
					{
						Type found = FindGenericType(generic, intfType);
						if (found != null) return found;
					}
				}
				type = type.BaseType;
			}
			return null;
		}
ExpressionParser