title: Return the highest value in the IEnumerable<T> list collection each step using OrderByDescending
body: <p>This is my first time asking a question on the site so I might not be doing this right. I need to find and return the highest values within my IEnumerable list but cannot show any duplicates. I also cannot use any copies or temporary collections, or use distinct. It must be done by first by taking the list and doing OrderByDescending.</p>
  <p>This is what I have so far:</p>
  <pre><code>public static IEnumerable&lt;T&gt; PullMax&lt;T&gt; (IEnumerable&lt;T&gt; sourcelist) where T : IComparable
  {
      IEnumerable&lt;T&gt; list = sourcelist.OrderByDescending(item =&gt; item);
  
      foreach (T item in list)
      {
          yield return item;
      }
  }
  
  
  </code></pre>
  <p>This is the result I get from this code:</p>
  <pre><code>
  foreach (int item in Util.PullMax(Util.GenRange(iMin, iMax).Concat(Util.GenRange(iMin + 5, iMax + 5))))
  {
      Console.Write($&quot;\nMaximum Value: {item}&quot;);
  }    
  
  </code></pre>
  <pre><code>Maximum Value: 15
  Maximum Value: 14
  Maximum Value: 13
  Maximum Value: 12
  Maximum Value: 11
  Maximum Value: 10
  Maximum Value: 10
  Maximum Value: 9
  Maximum Value: 9
  Maximum Value: 8
  Maximum Value: 8
  Maximum Value: 7
  Maximum Value: 6
  Maximum Value: 5
  Maximum Value: 4
  Maximum Value: 3
  </code></pre>
  <p>This should be the expected results:</p>
  <pre><code>Maximum Value: 15
  Maximum Value: 14
  Maximum Value: 13
  Maximum Value: 12
  Maximum Value: 11
  Maximum Value: 10
  Maximum Value: 9
  Maximum Value: 8
  Maximum Value: 7
  Maximum Value: 6
  Maximum Value: 5
  Maximum Value: 4
  Maximum Value: 3
  </code></pre>
  <p>I was asked to show Util.GenRange()</p>
  <pre><code>public static IEnumerable&lt;int&gt; GenRange(int iMin, int iMax)
          {
              while (true)
              {
                  for (int i = iMin; i &lt; iMax; i++)
                  {
                      yield return i;
                  }
                  yield break;
              }
          }
  </code></pre>
  <p>The result I am getting has duplicates and I cannot have them. How can I get rid of them without any copies or temporary collections or even using distinct?</p>