title: Are "One Shot" Property Getters considered an acceptable coding standard in .NET (or in general)
body: <p>Recently while doing some work with C# &amp; ActiveMQ (via the Apache.NMS libraryies) I came across the following property on the <code>ActiveMQBytesMessage</code></p>
  
  <pre><code>public new byte[] Content
  {
    get
    {
      byte[] buffer = (byte[]) null;
      this.InitializeReading();
      if (this.length != 0)
      {
        buffer = new byte[this.length];
        this.dataIn.Read(buffer, 0, buffer.Length);
      }
      return buffer;
    }
    ..(setter omitted)
  }
  </code></pre>
  
  <p>The <code>InitialiseReading</code> method handled the connection &amp; streaming of the data from active MQ into the <code>.dataIn</code> field. The problem though was that <strong>IT DID THIS EVERYTIME</strong>. And once that data was read, it could never be read again and the dataIn field was zero'd and reset. So simply by observing the property and observing it again, you lost the data. This made for some very strange bugs such as:</p>
  
  <pre><code>byte [] myBytes = new byte[msg.Content.Length]; 
  //Touched the property. Data read in.
  
  msg.Content.CopyTo(myBytes,0); 
  //Uh oh! touched it again, copying a zero'd array.
  </code></pre>
  
  <p>or when you were debugging and you stuck a watch variable on the property or accidentally hovered your mouse over the property.</p>
  
  <p>Is this kind of mechanism an accepted or prevalent way of using properties for streamed data.</p>