public override void SerializeContent(XmlWriter writer) { Guard.ArgumentNotNull(writer, "writer"); writer.WriteAttributeString(ParameterElement.NamePropertyName, this.Name); writer.WriteAttributeIfNotEmpty(ParameterElement.TypeNamePropertyName, this.TypeName); ValueElementHelper.SerializeParameterValueElement(writer, this.Value, false); }
/// <summary> /// Write the contents of this element to the given <see cref="XmlWriter"/>. /// </summary> /// <remarks>The caller of this method has already written the start element tag before /// calling this method, so deriving classes only need to write the element content, not /// the start or end tags.</remarks> /// <param name="writer">Writer to send XML content to.</param> public override void SerializeContent(XmlWriter writer) { writer.WriteAttributeIfNotEmpty(TypeNamePropertyName, this.TypeName); foreach (var valueElement in this.Values) { ValueElementHelper.SerializeParameterValueElement(writer, valueElement, true); } }
/// <summary> /// Causes the configuration system to throw an exception. /// </summary> /// <returns> /// true if the unrecognized element was deserialized successfully; otherwise, false. The default is false. /// </returns> /// <param name="elementName">The name of the unrecognized element. </param> /// <param name="reader">An input stream that reads XML from the configuration file. </param> /// <exception cref="T:System.Configuration.ConfigurationErrorsException">The element specified in <paramref name="elementName"/> is the <clear> element.</exception> /// <exception cref="T:System.ArgumentException"><paramref name="elementName"/> starts with the reserved prefix "config" or "lock".</exception> protected override bool OnDeserializeUnrecognizedElement(string elementName, System.Xml.XmlReader reader) { var holder = new DeserializedElementHolder(); var helper = new ValueElementHelper(holder); if (helper.DeserializeUnknownElement(elementName, reader)) { this.Add(holder.Value); return(true); } return(base.OnDeserializeUnrecognizedElement(elementName, reader)); }
/// <summary> /// Construct a new instance of <see cref="ParameterElement"/>. /// </summary> public ParameterElement() { this.valueElementHelper = new ValueElementHelper(this); }
/// <summary> /// Construct a new instance of <see cref="ParameterElement"/>. /// </summary> public ParameterElement() { valueElementHelper = new ValueElementHelper(this); }
/// <summary> /// Construct a new instance of <see cref="PropertyElement"/> /// </summary> public PropertyElement() { this.valueElementHelper = new ValueElementHelper(this); }
/// <summary> /// Write the contents of this element to the given <see cref="XmlWriter"/>. /// </summary> /// <remarks>The caller of this method has already written the start element tag before /// calling this method, so deriving classes only need to write the element content, not /// the start or end tags.</remarks> /// <param name="writer">Writer to send XML content to.</param> public override void SerializeContent(XmlWriter writer) { Guard.ArgumentNotNull(writer, "writer"); writer.WriteAttributeString(NamePropertyName, Name); ValueElementHelper.SerializeParameterValueElement(writer, Value, false); }