private XmlSchemaParticle CannonicalizePointlessRoot(XmlSchemaParticle particle) {
if (particle == null) {
return null;
}
XmlSchemaSequence xss;
XmlSchemaChoice xsc;
XmlSchemaAll xsa;
decimal one = decimal.One;
if ( (xss = (particle as XmlSchemaSequence)) != null ) {
XmlSchemaObjectCollection items = xss.Items;
int count = items.Count;
if (count == 1) {
if (xss.MinOccurs == one && xss.MaxOccurs == one) {
return (XmlSchemaParticle)items[0];
}
}
}
else if ( (xsc = (particle as XmlSchemaChoice)) != null ) {
XmlSchemaObjectCollection items = xsc.Items;
int count = items.Count;
if (count == 1) {
if (xsc.MinOccurs == one && xsc.MaxOccurs == one) {
return (XmlSchemaParticle)items[0];
}
}
else if (count == 0) {
return XmlSchemaParticle.Empty;
}
}
else if ( (xsa = (particle as XmlSchemaAll)) != null ) {
XmlSchemaObjectCollection items = xsa.Items;
int count = items.Count;
if (count == 1) {
if (xsa.MinOccurs == one && xsa.MaxOccurs == one) {
return (XmlSchemaParticle)items[0];
}
}
}
return particle;
}