private static IndirectGenericParameterSpecialization InitializeInstance(
            IndirectGenericParameterSpecialization instance)
        {
            instance.qualName = instance.Declaration.Name.Qualify(instance.ParentMember.FullName);
            instance.genericParameterCache = new Lazy <IReadOnlyList <IGenericParameter> >(
                instance.CreateGenericParameters);

            return(instance);
        }
        /// <summary>
        /// Specializes the generic parameter list of a generic member to
        /// an indirectly specialized generic parameter list for a
        /// specialization of the aforementioned generic member.
        /// </summary>
        /// <param name="genericMember">
        /// The original generic member whose generic parameters are specialized.
        /// </param>
        /// <param name="specializedMember">
        /// The proud parent of the indirectly specialized generic parameters
        /// produced by this method.
        /// </param>
        /// <returns>
        /// A list of indirectly specialized generic parameters.
        /// </returns>
        internal static IReadOnlyList <IndirectGenericParameterSpecialization> CreateAll(
            IGenericMember genericMember,
            IGenericMember specializedMember)
        {
            var originalTypeParams = genericMember.GenericParameters;
            var results            = new IndirectGenericParameterSpecialization[originalTypeParams.Count];

            for (int i = 0; i < results.Length; i++)
            {
                results[i] = Create(originalTypeParams[i], specializedMember);
            }
            return(results);
        }
 private IReadOnlyList <IGenericParameter> CreateGenericParameters()
 {
     return(IndirectGenericParameterSpecialization.CreateAll(Declaration, this));
 }