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 8299121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:02:06+00:00 2026-06-08T16:02:06+00:00

My .NET application works with collection of users. A User object contain the username,

  • 0

My .NET application works with collection of users. A User object contain the username, the fullname, the domain….

I wonder which type of collection should I prefer to store the users, between a 1) List or 2) Dictionary, where the dictionary key is the username.

I understand that the dictionary option is fastest when having to retrieve a user from its username, but because the username is referenced twice consistency error might occurs. (as dictionary key and as user attribute)?
Could you also explain me what are the differences from a design point of view?

  • 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-08T16:02:09+00:00Added an answer on June 8, 2026 at 4:02 pm

    The best approach from design point of view is to create a custom class UserCollection and hide the actual storage details. This gives you an ability to change from List to Dictionary without impact to other code. Suppose it is an additional layer of abstraction.

    The differences between List and Dictionary are conceptual. Simple rule – if items are unique and you need a O(c) search complexity then use a Dictionary, otherwise use a List.

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

Sidebar

Related Questions

I have an ASP.NET 3.5 web application which works perfectly fine on my local
I am using an ASP.Net Web Application project. I have a user control which
I have an Asp.Net MVC application that works in the vs.net development web server.
I have an ASP.NET 3.0 application that works fine on one server. It uses
0 I have an ASP.NET 3.0 application that works fine on one server. It
I am using NSIS to deploy a .Net application. The installation/uninstallation process works fine,
I am working on ASP.NET 4.0 MVC3 web application that works in intranet environment.
We have an internal ASP.NET MVC application that requires a logon. Log on works
I built an application in c# vs2005 .net . Everything works fine when i
I'm trying to enforce windows authentication for users of a .Net application on Web

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.