title: Implementing IDisposable correctly
body: <p>In my classes I implement <code>IDisposable</code> as follows:</p>
  <pre><code>public class User : IDisposable
  {
      public int id { get; protected set; }
      public string name { get; protected set; }
      public string pass { get; protected set; }
  
      public User(int UserID)
      {
          id = UserID;
      }
      public User(string Username, string Password)
      {
          name = Username;
          pass = Password;
      }
  
      // Other functions go here...
  
      public void Dispose()
      {
          // Clear all property values that maybe have been set
          // when the class was instantiated
          id = 0;
          name = String.Empty;
          pass = String.Empty;
      }
  }
  </code></pre>
  <p>In VS2012, my Code Analysis says to implement IDisposable correctly, but I'm not sure what I've done wrong here.<br />
  The exact text is as follows:</p>
  <blockquote>
  <p>CA1063 Implement IDisposable correctly Provide an overridable implementation of Dispose(bool) on 'User' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. stman   User.cs 10</p>
  </blockquote>
  <p>For reference: <a href="http://msdn.microsoft.com/query/dev11.query?appId=Dev11IDEF1&amp;l=EN-US&amp;k=k%28CA1063%29;k%28TargetFrameworkMoniker-.NETFramework,Version=v4.5%29&amp;rd=true" rel="noreferrer">CA1063: Implement IDisposable correctly</a></p>
  <p>I've read through this page, but I'm afraid I don't really understand what needs to be done here.</p>
  <p>If anyone can explain in more layman's terms what the problem is and/or how <code>IDisposable</code> should be implemented, that will really help!</p>