System.Xml.Serialization.XmlSchemaImporter.GenerateUniqueTypeName C# (CSharp) Method

GenerateUniqueTypeName() private method

private GenerateUniqueTypeName ( string desiredName, string ns ) : string
desiredName string
ns string
return string
        private string GenerateUniqueTypeName(string desiredName, string ns)
        {
            int i = 1;

            string typeName = desiredName;
            while (true)
            {
                XmlQualifiedName qname = new XmlQualifiedName(typeName, ns);

                object type = Schemas.Find(qname, typeof(XmlSchemaType));
                if (type == null)
                {
                    break;
                }
                typeName = desiredName + i.ToString(CultureInfo.InvariantCulture);
                i++;
            }
            typeName = CodeIdentifier.MakeValid(typeName);
            return TypeIdentifiers.AddUnique(typeName, typeName);
        }