title: Why are properties without a setter not serialized
body: <p>I have a serializable class and one of the properties in my class generates a <code>Guid</code> in the getter. The property implements no setter and is ignores during serialization. Why is that and do I always have to implement a setter in order for my property to be serialized.</p>
  
  <pre><code>[Serializable]
  public class Example
  {
      [XmlAttribute("id")]
      public string Id
      {
          get
          {
               return Guid.NewGuid().ToString();
          }
      }
  }
  </code></pre>
  
  <p>I tried implementing an empty setter and it got serialized correctly.</p>
  
  <pre><code>[Serializable]
  public class Example
  {
      [XmlAttribute("id")]
      public string Id
      {
          get
          {
               return Guid.NewGuid().ToString();
          }
          set {}
      }
  }
  </code></pre>
  
  <p><strong>Update</strong>:</p>
  
  <p>Can you point out how should I define properties whose values never change or ones that the value for is generated internally?</p>