title: C# Ordered dictionary index
body: <p>I am considering of using the OrderedDictionary. As a key I want to use a long value (id) and the value will be a custom object.</p>
  
  <p>I use the OrderedDictionary because I want to get an object by it's Id and I want to get an object by it's 'collection' index.</p>
  
  <p>I want to use the OrderedDictionary like this:</p>
  
  <pre><code>public void AddObject(MyObject obj)
  {
    _dict.Add(obj.Id, obj); // dict is declared as OrderedDictionary _dict = new OrderedDictionary();
  }
  </code></pre>
  
  <p>Somewhere else in my code I have something similar like this:</p>
  
  <pre><code>public MyObject GetNextObject()
  {
    /* In my code keep track of the current index */
  
    _currentIndex++;
    // check _currentindex doesn't exceed the _questions bounds
    return _dict[_currentIndex] as MyObject;
  }
  </code></pre>
  
  <p>Now my question is. In the last method I've used an index. Imagine _currentIndex is set to 10, but I have also an object with an id of 10. I've set the Id as a key. </p>
  
  <p>The Id of MyObject is of type long?. Does this goes wrong?</p>