title: Iterating through diff changes in LibGit2Sharp
body: <p>What could be the best (as in performant, simple) way to iterate over <a href="https://github.com/libgit2/libgit2sharp/blob/vNext/LibGit2Sharp/TreeChanges.cs" rel="nofollow"><code>TreeChanges</code></a> in LibGit2Sharp?</p>
  
  <p>If I access the <code>.Patch</code> property, I retrieve the full text of the changes. This is not quite enough for me... ideally I would like to be able to iterate over the diff lines, and per each line retrieve the status of the line (modified, added, deleted) and build my own output out of it.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Let's say I want to build my own diff output. What I'd like to do is to iterate over the changed lines, and during iteration I would check for the type of change (added, removed), and construct my output.</p>
  
  <p>For example:</p>
  
  <pre><code>var diff = "";
  foreach (LineChange line in changes) // Bogus class "LineChange"
  {
      if (line.Type == LineChange.TYPE_ADDED)
          diff += "+";
      else
          diff += "-";
  
      diff += line.Content;
      diff += "\n";
  }
  </code></pre>
  
  <p>The above is just a simple example what kind of flexibility I'm looking for. To be able to go through the changes, and run some logic along with it depending on the line change types. The <code>Patch</code> property is already "built", one way would be to parse it, but it seems silly that the library first builds the output, and then I parse it... I'd rather use the building ingredients directly.</p>
  
  <p>I need this kind of functionality so that I can display a visual diff of changes which involves far more code and logic than the simple example I gave above.</p>