title: Set rank based on Value in List
body: <p>I am trying to find better way to solve my problem.
  I have a list with properties. Some properties should be "ranked" (who is better).</p>
  
  <p>Here are data structures:</p>
  
  <pre><code>public class MovieRankData
  {
      public Guid MovieId { get; set; }
      public RankData TotalViews { get; set; }
      public RankData TotalMoney { get; set; }
  }
  
  public class RankData
  {
      public string Name { get; set; }
      public double? Value { get; set; }
      public int Rank { get; set; }
  }
  </code></pre>
  
  <p>And very simple code (please see comments):</p>
  
  <pre><code>var movieRankData = new List&lt;MovieRankData&gt;
  {
      new MovieRankData
      {
          MovieId = Guid.NewGuid(),
          TotalViews = new RankData {Name = "Total Movie View", Value = 985 },    // Rank should be 2 (of 3)
          TotalMoney = new RankData {Name = "Total Movie Money", Value = 525.12}, // Rank should be 1 (of 3)
      },
  
      new MovieRankData
      {
          MovieId = Guid.NewGuid(),
          TotalViews = new RankData {Name = "Total Movie View", Value = 812},  // Rank should be 3 (of 3)
          TotalMoney = new RankData {Name = "Total Movie Money", Value = 100}, // Rank should be 3 (of 3)
      },
  
      new MovieRankData
      {
          MovieId = Guid.Empty,
          TotalViews = new RankData {Name = "Total Movie View", Value = 1000}, // Rank should be 1 (of 3)
          TotalMoney = new RankData {Name = "Total Movie Money", Value = 321}, // Rank should be 2 (of 3)
      }
  };
  </code></pre>
  
  <p>I came up with ugly foreach, many temporary variables to compare and set Rank property.</p>
  
  <p>What is the better way to go through each element, compare it to others and to rate it?</p>
  
  <p>Thanks for advice!</p>