System.Reflection.Emit.TypeBuilderInstantiation.Substitute C# (CSharp) Method

Substitute() private method

private Substitute ( Type substitutes ) : Type
substitutes System.Type
return System.Type
        internal Type Substitute(Type[] substitutes)
        {
            Type[] inst = GetGenericArguments();
            Type[] instSubstituted = new Type[inst.Length];

            for (int i = 0; i < instSubstituted.Length; i++)
            {
                Type t = inst[i];
                
                if (t is TypeBuilderInstantiation)
                {
                    instSubstituted[i] = (t as TypeBuilderInstantiation).Substitute(substitutes);
                }
                else if (t is GenericTypeParameterBuilder)
                {
                    // Substitute
                    instSubstituted[i] = substitutes[t.GenericParameterPosition];
                }
                else
                {
                    instSubstituted[i] = t;
                }
            }

            return GetGenericTypeDefinition().MakeGenericType(instSubstituted);
        }
        public override Type BaseType