/// <summary> /// Public Constructor. /// </summary> /// <param name="prefix"></param> /// <param name="namespaceUri"></param> /// <param name="namespacePosition"></param> public SyndicationModule(string prefix, string namespaceUri, SyndicationModuleNamespacePosition namespacePosition) { this.m_prefix = NormalizePrefix(prefix); this.m_namespaceUri = NormalizeNamespaceUri(namespaceUri); this.m_namespacePosition = namespacePosition; // // The following combination is not valid. You cannot // set a namespace at document-element level and not // have a prefix. // if (namespacePosition == SyndicationModuleNamespacePosition.DocumentElement && !this.IsValidPrefix()) { string msg = string.Format("SyndicationModule cannot have a namespace positioned at DocumentElement without prefix value."); throw new ArgumentException(msg, "prefix,namespacePosition"); } // // The following combination is not valid. You cannot // have a module with a prefix but not a namespace. // if (!IsValidNamespaceURI() && IsValidPrefix()) { string msg = string.Format("SyndicationModule cannot have a prefix and not a namespace."); throw new ArgumentException(msg, "prefix,namespaceUri"); } }
/// <summary> /// Gets the specified SyndicationModule with given prefix, namespaceUri and namespacePosition. /// </summary> public SyndicationModule this[string prefix, string namespaceUrl, SyndicationModuleNamespacePosition namespacePosition] { get { foreach (SyndicationModule module in this) { if (module.Prefix == prefix && module.NamespaceURI == namespaceUrl && module.NamespacePosition == namespacePosition) { return(module); } } return(null); } }