internal static XmlSchemaObjectCollection CloneAttributes(XmlSchemaObjectCollection attributes) { if (!HasAttributeQNameRef(attributes)) { return attributes; } XmlSchemaObjectCollection objects = attributes.Clone(); for (int i = 0; i < attributes.Count; i++) { XmlSchemaObject obj2 = attributes[i]; XmlSchemaAttributeGroupRef ref2 = obj2 as XmlSchemaAttributeGroupRef; if (ref2 != null) { XmlSchemaAttributeGroupRef ref3 = (XmlSchemaAttributeGroupRef) ref2.Clone(); ref3.RefName = ref2.RefName.Clone(); objects[i] = ref3; } else { XmlSchemaAttribute attribute = obj2 as XmlSchemaAttribute; if (!attribute.RefName.IsEmpty || !attribute.SchemaTypeName.IsEmpty) { objects[i] = attribute.Clone(); } } } return objects; }