System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict C# (CSharp) Method

CheckTypeNameConflict() private method

private CheckTypeNameConflict ( String strTypeName, TypeBuilder enclosingType ) : void
strTypeName String
enclosingType TypeBuilder
return void
        internal void CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType)
        {
            BCLDebug.Log("DYNIL","## DYNIL LOGGING: AssemblyBuilderData.CheckTypeNameConflict( " + strTypeName + " )"); 
            for (int i = 0; i < m_moduleBuilderList.Count; i++) 
            {
                ModuleBuilder curModule = (ModuleBuilder)m_moduleBuilderList[i];
                for (int j = 0; j < curModule.m_TypeBuilderList.Count; j++)
                {
                    Type curType = (Type)curModule.m_TypeBuilderList[j];
                    if (curType.FullName.Equals(strTypeName) && curType.DeclaringType == enclosingType)
                    {
                        // Cannot have two types with the same name
                        throw new ArgumentException(Environment.GetResourceString("Argument_DuplicateTypeName"));
                    }
                }
            }

            // Also check to see if there is any loaded type with the same name.
            // You only need to make this test for non-nested types since any
            // duplicates in nested types will be caught at the top level.
            if ((enclosingType == null) && !(m_assembly is AssemblyBuilder))
            {
                if (m_assembly.GetType(strTypeName, false, false) != null)
                {
                    // Cannot have two types with the same name
                    throw new ArgumentException(Environment.GetResourceString("Argument_DuplicateTypeName"));
                }
            }
        }