本文整理匯總了C#中System.Xml.Schema.XmlSchemaObjectCollection.Clone方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchemaObjectCollection.Clone方法的具體用法?C# XmlSchemaObjectCollection.Clone怎麽用?C# XmlSchemaObjectCollection.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.Schema.XmlSchemaObjectCollection
的用法示例。
在下文中一共展示了XmlSchemaObjectCollection.Clone方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CloneAttributes
internal static XmlSchemaObjectCollection CloneAttributes(XmlSchemaObjectCollection attributes) {
if (HasAttributeQNameRef(attributes)) {
XmlSchemaObjectCollection newAttributes = attributes.Clone();
XmlSchemaAttributeGroupRef attributeGroupRef;
XmlSchemaAttributeGroupRef newAttGroupRef;
XmlSchemaObject xso;
XmlSchemaAttribute att;
for (int i = 0; i < attributes.Count; i++) {
xso = attributes[i];
attributeGroupRef = xso as XmlSchemaAttributeGroupRef;
if (attributeGroupRef != null) {
newAttGroupRef = (XmlSchemaAttributeGroupRef)attributeGroupRef.Clone();
newAttGroupRef.RefName = attributeGroupRef.RefName.Clone();
newAttributes[i] = newAttGroupRef;
}
else { //Its XmlSchemaAttribute
att = xso as XmlSchemaAttribute;
if (!att.RefName.IsEmpty || !att.SchemaTypeName.IsEmpty) {
newAttributes[i] = att.Clone();
}
}
}
return newAttributes;
}
return attributes;
}
示例2: CloneGroupBaseParticles
private static XmlSchemaObjectCollection CloneGroupBaseParticles(XmlSchemaObjectCollection groupBaseParticles, XmlSchema parentSchema) {
XmlSchemaObjectCollection newParticles = groupBaseParticles.Clone();
for (int i = 0; i < groupBaseParticles.Count; i++) {
XmlSchemaParticle p = (XmlSchemaParticle)groupBaseParticles[i];
newParticles[i] = CloneParticle(p, parentSchema);
}
return newParticles;
}
示例3: CloneAttributes
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;
}