void ApplyConfiguration(string configurationName) { UdpBindingCollectionElement section = (UdpBindingCollectionElement)ConfigurationManager.GetSection(UdpConstants.UdpBindingSectionName); UdpBindingConfigurationElement element = section.Bindings[configurationName]; if (element == null) { throw new ConfigurationErrorsException(string.Format(System.Globalization.CultureInfo.CurrentCulture, "There is no binding named {0} at {1}.", configurationName, section.BindingName)); } else { element.ApplyConfiguration(this); } }
public UdpBinding(string configurationName) : this() { UdpBindingCollectionElement section = UdpBindingCollectionElement.GetBindingCollectionElement(); UdpBindingElement element = section.Bindings[configurationName]; if (element == null) { throw FxTrace.Exception.AsError(new ConfigurationErrorsException( SR.GetString(SR.ConfigInvalidBindingConfigurationName, configurationName, UdpTransportConfigurationStrings.UdpBindingElementName))); } else { element.ApplyConfiguration(this); } }