private static MethodInfo MakeConcreteMethod(MethodInfo method, LinkList <Type> openArguments, LinkList <Binding> bindings)
        {
            Debug.Assert(method != null);
            Debug.Assert(openArguments != null);
            Debug.Assert(bindings != null);

            // If the method is not generic, return it immediately.
            if (!method.IsGenericMethodDefinition)
            {
                Debug.Assert(openArguments.IsEmpty);
                return(method);
            }

            // Otherwise, retrieve bindings for open arguments and construct the method.
            var boundArguments = GenericTypeResolver.BindConcreteArguments(openArguments, bindings);

            var concreteMethod = (boundArguments.Length == openArguments.Count
                ? method.MakeGenericMethod(boundArguments)
                : null);

            return(concreteMethod);
        }
        private static Type MakeConcreteType(Type genericType, LinkList <Type> openArguments, LinkList <Binding> bindings)
        {
            Debug.Assert(genericType != null);
            Debug.Assert(openArguments != null);
            Debug.Assert(bindings != null);

            // If the type is concrete, return it immediately.
            if (!genericType.ContainsGenericParameters)
            {
                Debug.Assert(openArguments.IsEmpty);
                return(genericType);
            }

            // Otherwise, retrieve bindings for open arguments and construct the type.
            var boundArguments = GenericTypeResolver.BindConcreteArguments(openArguments, bindings);

            Debug.Assert(boundArguments.Length <= openArguments.Count);
            var concreteType = (boundArguments.Length == openArguments.Count
                ? genericType.MakeGenericType(boundArguments)
                : null);

            return(concreteType);
        }