/// <summary> /// Returns a constructed type given its instance type and type arguments. /// </summary> /// <param name="instanceType">the instance type to construct the result from</param> /// <param name="typeArguments">the immediate type arguments to be replaced for type parameters in the instance type</param> /// <returns></returns> internal static NamedTypeSymbol Construct1(this NamedTypeSymbol instanceType, ReadOnlyArray <TypeSymbol> typeArguments) { Debug.Assert(instanceType.ConstructedFrom == instanceType); var sequenceEqual = true; var args = instanceType.TypeArguments; if (args.Count != typeArguments.Count) { sequenceEqual = false; } else { for (int i = 0; i < args.Count; i++) { if (args[i] != typeArguments[i]) { sequenceEqual = false; break; } } } return(sequenceEqual ? instanceType : ConstructedNamedTypeSymbol.Make(instanceType, typeArguments)); }