title: Looking for an inbuilt ordered list in C#
body: <p>I'm having a problem ordering the lists in C#. The solutions I come up with are unwieldy and seem a bit of a hack to me. I am looking for an elegant solution to the problem described below.
  I want to make the ordering remain in the class to avoid using .Sort() or .OrderBy() in other parts of the code.
  A 9 year old posting suggests that no such class/solution exists. But, I cannot help feeling there is something similar to an OrderedList somewhere which is not an IDictionary.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  namespace ConsoleApp5
  {
      class Program
      {
          static void Main(string[] args)
          {
                  var obj = new Class1();
                  obj.Test();
          }
      }
  
      public class Class1
      {
          public void Test()
          {
              var myList = new List&lt;MyObject&gt;();
  
              myList.Add(new MyObject { Id = 1, Name = "ZZZ" });
              myList.Add(new MyObject { Id = 2, Name = "NNN" });
              myList.Add(new MyObject { Id = 3, Name = "PPP" });
              myList.Add(new MyObject { Id = 4, Name = "AAA" });
  
              foreach (var obj in myList)
              {
                  Console.WriteLine($"{obj.Name} -&gt; {obj.Id}");
              }
  
          }
  
          public class MyObject
          {
              public int Id { get; set; }
              public string Name { get; set; }
  
          }
      }
  }
  </code></pre>
  
  <p>And the list is printed out in the order:</p>
  
  <pre><code>ZZZ -&gt; 1
  NNN -&gt; 2
  PPP -&gt; 3
  AAA -&gt; 4
  </code></pre>
  
  <p>Could anyone suggest an appropriate class for an ordered list which would deliver:</p>
  
  <pre><code>AAA -&gt; 4
  NNN -&gt; 2
  PPP -&gt; 3
  ZZZ -&gt; 1
  </code></pre>