Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 /// <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 &lt;clear&gt; 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));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Construct a new instance of <see cref="ParameterElement"/>.
 /// </summary>
 public ParameterElement()
 {
     this.valueElementHelper = new ValueElementHelper(this);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Construct a new instance of <see cref="ParameterElement"/>.
 /// </summary>
 public ParameterElement()
 {
     valueElementHelper = new ValueElementHelper(this);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Construct a new instance of <see cref="PropertyElement"/>
 /// </summary>
 public PropertyElement()
 {
     this.valueElementHelper = new ValueElementHelper(this);
 }
Ejemplo n.º 8
0
 /// <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);
 }