Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:06:42+00:00 2026-06-09T00:06:42+00:00

.NET Documentation for 3.5 Collections.Generic.SortedList In the documentation, it plainly states that ElementAt is

  • 0

.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 :-\

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:06:44+00:00Added an answer on June 9, 2026 at 12:06 am

    Try adding an import to the top of your code file:

    using System.Linq;
    

    You need to specify that you’re using the namespace containing the extension method before you can actually use the extension method. So, as the error explained, you were missing a using-directive.

    If you do know that the method is an extension method, but you don’t know in which namespace it lives, then you’ll probably need to search online to find it. Visual Studio 2012 by default cannot resolve it for you. The extension method you are talking about is Enumerable.ElementAt in the System.Linq namespace of System.Core.dll.

    In Visual Studio, when you create a new class file, you’ll have using System.Linq inserted at the top automatically. That namespace contains all the LINQ extension methods for working with all kinds of collections (including lists, dictionaries and arrays).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The documentation for the .NET Semaphore class states that: There is no guaranteed order,
I found the following claim in the documentation for Net::OpenSSH : Note that using
Need a list of Pcap.Net members or classes? Their website doesn't have much documentation
The CruiseControl.Net documentation advises against using the NUnit task, suggesting instead that NUnit is
When an object is added to the .NET System.Collections.Generic.Dictionary class the hashcode of the
While experimenting with this question on collections in Spring.NET , I discovered that Spring
I've been scouring the net and documentation to no avail. I can seed random
I am reading the Asp.net security documentation on msdn.I come across these tow terms
The documentation for .NET's Excel interop API at msdn.com seems rather sparse. Does anyone
The documentation on php.net is very spotty about causes of failure for APC writes.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.