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

  • Home
  • SEARCH
  • 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 105749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:29:18+00:00 2026-05-11T01:29:18+00:00

What is the meaning of the .NET 3.5 extension method Enumerable.First() when you call

  • 0

What is the meaning of the .NET 3.5 extension method Enumerable.First() when you call it on an instance of the Dictionary collection?

Does the set of keys determine which item is first, or is it just not defined?

  • 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. 2026-05-11T01:29:18+00:00Added an answer on May 11, 2026 at 1:29 am

    Well, I believe the set of keys will determine which item is first, but not in a well-defined (or easy to predict) way. In other words, don’t assume that it will always work the same way – it’s as unsafe as relying on a hash code implementation staying the same between runs.

    EDIT: I believe that in fact, the ordering of insertion does matter, contrary to my previous ideas. However, this is implementation-specific (so could easily change in the next version). I believe that with the current implementation, the first entry added will be the first one returned if it hasn’t been removed. If the first entry added is ever removed, the ordering is broken – it’s not that the earliest entry is removed. Here’s an example:

    using System; using System.Collections.Generic;  class Test {     static void Main(string[] args)     {         var dict = new Dictionary<int, int>();                 dict.Add(0, 0);         dict.Add(1, 1);         dict.Add(2, 2);         dict.Remove(0);         dict.Add(10, 10);          foreach (var entry in dict)         {             Console.WriteLine(entry.Key);         }         Console.WriteLine('First key: ' + dict.First().Key);     } } 

    The results are 10, 1, 2, and ‘First key: 10’ – showing that the latest added entry ends up being returned first.

    However, I’d like to stress again that everything can change between versions of the framework.

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

Related Questions

Loading...

Sidebar

Ask A Question

Stats

  • Questions 55k
  • Answers 55k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer In MS SQL and Oracle: SELECT * FROM ( SELECT… May 11, 2026 at 7:36 am
  • added an answer Usually i just dock different forms within eachother setting the… May 11, 2026 at 7:36 am
  • added an answer Odd, seems to be some sort of bug in .NET… May 11, 2026 at 7:36 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

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.