title: Using GetValue method in instance method of a class in C#
body: <p>I have simple class with method <code>ToHtmlString()</code> and I want to enumerate all private and instance properties of this object(reference). Why I can't take the value. I see I need to pass object to <code>GetValue</code> method in order runtime to know which value of which reference reflection will get, but it seems like I CAN'T do it like that? How can I use <code>GetValue</code> while enumerating all properties of this instance?</p>
  
  <pre><code>    public string ToHtmlString()
      {
          var source = this;
          var html = new StringBuilder();
  
          foreach (var property in this.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Instance))
          {
              html.AppendLine(
                  new GenericItemView(
                      (property.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute)?.Description,
                      property.GetValue(source).ToString());
          }
  
          return html.ToString();
      }
  </code></pre>