How to get an element from Dictionary without knowing the key



  • There's a dictionary like Dictionary(Of Integer, ObjectPool)

    1. Cycle free foreach Get the object out of him without knowing the key?
    2. Can we get the first or last object in the vocabulary without dialing the elements?


  • Dictionary<TKey,TValue> Interfaces IEnumerable<T> It is therefore possible to use Linq methods: https://msdn.microsoft.com/en-us/library/bb535050(v=vs.100).aspx ♪ https://msdn.microsoft.com/ru-ru/library/bb549138(v=vs.110).aspx And so on.

    For example:

    Dim first As ObjectPool = dict.FirstOrDefault().Value
    Dim last As ObjectPool = dict.LastOrDefault().Value
    

    But since the interface doesn't work. IList<T> - No index.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2