private void MoveAttributes(XmlSchemaComplexType ct, XmlSchemaSimpleContentExtension simpleContentExtension, bool bCreatingNewType) {
//copy all attributes from the complex type to the simple content
ICollection sourceCollection;
if (!bCreatingNewType && ct.AttributeUses.Count > 0) {
sourceCollection = ct.AttributeUses.Values;
}
else {
sourceCollection = ct.Attributes;
}
foreach (XmlSchemaAttribute attr in sourceCollection) {
simpleContentExtension.Attributes.Add(attr);
}
ct.Attributes.Clear(); //Clear from pre-compiled property, post compiled will be cleared on Re-process and Compile()
}