title: serialize attribute without value in C#
body: <p>I am working on a WCF service and our team wants to be able to serialize a valueless attribute form the contract. for example the xml would look like this:</p>
  
  <pre><code>&lt;Payload&gt;
    &lt;Options all&gt;&lt;/Options&gt;
  &lt;/Payload&gt;
  </code></pre>
  
  <p>as you can see <strong>all</strong> is passed as an attribute, only when the user wants all the options. the value all will not be provided if all is not provided. </p>
  
  <p>This would be how the request for all options would be sumitted, vs a request for specific options</p>
  
  <pre><code>&lt;Payload&gt;
    &lt;OptionList&gt;
      &lt;Option&gt;option 1&lt;/Option&gt;
      &lt;Option&gt;option 2&lt;/Option&gt;
    &lt;/OptionList&gt;
  &lt;/Payload&gt;
  </code></pre>
  
  <p>I currently have a Option data contract as follows:</p>
  
  <pre><code>[CollectionDataContract(ItemName="Option", Name="OptionList", Namespace="")]
  public class OptionListV1:List&lt;string&gt;, IExtensibleDataObject
  {
      public ExtensionDataObject ExtensionData { get; set; }
  }
  </code></pre>
  
  <p>I know there is the XmlSerializerFormat attribute, but I am having a hard time determining if I can serialize a valueless attribute with the XmlSerializer.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>TL;DR:</strong> I want to serialize/deserialize a boolean property as a valueless attribute.</p>
  
  <p><strong>update</strong> if you believe this is a duplicate question, please answer the question with a link to the existing question.</p>