title: How can I use LINQ to calculate the longest streak?
body: <p>Currently, this is just something I am curious about, I don't have any code I am working on but I am wondering how this could be achieved...</p>
  
  <p>Lets say for example that I have an application that tracks the results of all the football teams in the world. What I want to be able to do is to identify the longest "win" streak for any given team.</p>
  
  <p>I imagine I would most likely have some sort of data table like so:</p>
  
  <ul>
  <li>MatchDate datetime</li>
  <li>TeamA string</li>
  <li>TeamB string</li>
  <li>TeamAGoals int</li>
  <li>TeamBGoals int</li>
  </ul>
  
  <p>So what I would want to do for example is find the longest win streak where <code>TeamA = "My Team"</code> and obviously this would mean <code>TeamAGoals</code> must be greater than <code>TeamBGoals</code>.</p>
  
  <p>As I have said, this is all just for example. It may be better for a different DB design for something like this. But the root question is how to calculate the longest streak/run of matching results.</p>