.NET Documentation for 3.5 Collections.Generic.SortedList
In the documentation, it plainly states that "ElementAt" is an extension method on SortedList
members. Well, I've got one, declared thusly:
private SortedList<int, ChainLink> linksByLevel = new SortedList<int, ChainLink>();
I try to get the last element:
ChainLink lastLink = linksByLevel.ElementAt(linksByLevel.Count - 1);
The compiler throws the massively helpful message:
Error 1 'System.Collections.Generic.SortedList' does not contain a definition for 'ElementAt' and no extension method 'ElementAt' accepting a first argument of type '
System.Collections.Generic.SortedList<int,ChainLink>'
could be found (are you missing a using directive or an assembly reference?)
I'm getting pretty frustrated by the lack of coherence in Microsoft's documentation and my compiler and would love to rant about the inconsistencies between the APIs for SortedList
and SortedList<T1, T2>
, but I doubt that would add much value to my question. Just trust me, it's frustrating :-\