public static string GetBindingElementXml(this ConfigurationElement configurationElement, string bindingName)
 {
     if (configurationElement is IBindingElementDecorator bindingElementDecorator)
     {
         configurationElement = (ConfigurationElement)bindingElementDecorator.DecoratedBindingElement;
     }
     using (var configurationProxy = new ConfigurationProxy())
     {
         configurationProxy.SetBindingElement(configurationElement);
         return(configurationProxy.GetBindingElementXml(bindingName));
     }
 }
        public static string GetBindingElementXml(this ConfigurationElement configurationElement, string bindingName)
        {
            var bindingElementDecorator = configurationElement as IBindingElementDecorator;

            if (bindingElementDecorator != null)
            {
                configurationElement = (ConfigurationElement)bindingElementDecorator.DecoratedBindingElement;
            }

            var configurationProxy = new ConfigurationProxy();

            configurationProxy.SetBindingElement(configurationElement);
            return(configurationProxy.GetBindingElementXml(bindingName));
        }