public static ReliableSessionBindingElementImporter.Wsrm11PolicyAlternative ImportAlternative(MetadataImporter importer, IEnumerable <XmlElement> alternative)
            {
                ReliableSessionBindingElementImporter.State security = ReliableSessionBindingElementImporter.State.Security;
                ReliableSessionBindingElementImporter.Wsrm11PolicyAlternative alternative2 = new ReliableSessionBindingElementImporter.Wsrm11PolicyAlternative();
                foreach (XmlElement element in alternative)
                {
                    switch (security)
                    {
                    case ReliableSessionBindingElementImporter.State.Security:
                        security = ReliableSessionBindingElementImporter.State.DeliveryAssurance;
                        if (alternative2.TryImportSequenceSTR(element))
                        {
                            continue;
                        }
                        break;

                    case ReliableSessionBindingElementImporter.State.DeliveryAssurance:
                        security = ReliableSessionBindingElementImporter.State.Done;
                        if (alternative2.TryImportDeliveryAssurance(importer, element))
                        {
                            continue;
                        }
                        break;
                    }
                    string message = System.ServiceModel.SR.GetString("UnexpectedXmlChildNode", new object[] { element.LocalName, element.NodeType, "RMAssertion" });
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidChannelBindingException(message));
                }
                return(alternative2);
            }
            private bool TryImportDeliveryAssurance(MetadataImporter importer, XmlElement node)
            {
                string ns = "http://docs.oasis-open.org/ws-rx/wsrmp/200702";

                if (!ReliableSessionBindingElementImporter.IsElement(node, ns, "DeliveryAssurance"))
                {
                    return(false);
                }
                IEnumerator nodes   = node.ChildNodes.GetEnumerator();
                XmlElement  element = ReliableSessionBindingElementImporter.ThrowIfNotPolicyElement(ReliableSessionBindingElementImporter.SkipToNode(nodes), ReliableMessagingVersion.WSReliableMessaging11);

                foreach (IEnumerable <XmlElement> enumerable2 in importer.NormalizePolicy(new XmlElement[] { element }))
                {
                    ReliableSessionBindingElementImporter.State assurance = ReliableSessionBindingElementImporter.State.Assurance;
                    foreach (XmlElement element2 in enumerable2)
                    {
                        switch (assurance)
                        {
                        case ReliableSessionBindingElementImporter.State.Assurance:
                        {
                            assurance = ReliableSessionBindingElementImporter.State.Order;
                            if ((!ReliableSessionBindingElementImporter.IsElement(element2, ns, "ExactlyOnce") && !ReliableSessionBindingElementImporter.IsElement(element2, ns, "AtMostOnce")) && !ReliableSessionBindingElementImporter.IsElement(element2, ns, "AtMostOnce"))
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidChannelBindingException(System.ServiceModel.SR.GetString("DeliveryAssuranceRequired", new object[] { ns, element2.LocalName, element2.NamespaceURI })));
                            }
                            continue;
                        }

                        case ReliableSessionBindingElementImporter.State.Order:
                            assurance = ReliableSessionBindingElementImporter.State.Done;
                            if (ReliableSessionBindingElementImporter.IsElement(element2, ns, "InOrder"))
                            {
                                if (!this.isOrdered)
                                {
                                    this.isOrdered = true;
                                }
                                continue;
                            }
                            break;
                        }
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidChannelBindingException(System.ServiceModel.SR.GetString("UnexpectedXmlChildNode", new object[] { element2.LocalName, element2.NodeType, "DeliveryAssurance" })));
                    }
                    if (assurance == ReliableSessionBindingElementImporter.State.Assurance)
                    {
                        string message = System.ServiceModel.SR.GetString("DeliveryAssuranceRequiredNothingFound", new object[] { ns });
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidChannelBindingException(message));
                    }
                }
                System.Xml.XmlNode node2 = ReliableSessionBindingElementImporter.SkipToNode(nodes);
                if (node2 != null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidChannelBindingException(System.ServiceModel.SR.GetString("UnexpectedXmlChildNode", new object[] { node2.LocalName, node2.NodeType, node.LocalName })));
                }
                return(true);
            }