System.Xml.Schema.XmlSchemaAttribute.Clone C# (CSharp) Méthode

Clone() private méthode

private Clone ( ) : XmlSchemaObject
Résultat XmlSchemaObject
         internal override XmlSchemaObject Clone() {
            XmlSchemaAttribute newAtt = (XmlSchemaAttribute)MemberwiseClone();

            //Deep clone the QNames as these will be updated on chameleon includes
            newAtt.refName = this.refName.Clone();
            newAtt.typeName = this.typeName.Clone(); 
            return newAtt;
        }
    }

Usage Example

 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;
 }