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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:48:55+00:00 2026-05-14T22:48:55+00:00

I am considering of using the OrderedDictionary. As a key I want to use

  • 0

I am considering of using the OrderedDictionary. As a key I want to use a long value (id) and the value will be a custom object.

I use the OrderedDictionary because I want to get an object by it’s Id and I want to get an object by it’s ‘collection’ index.

I want to use the OrderedDictionary like this:

public void AddObject(MyObject obj)
{
  _dict.Add(obj.Id, obj); // dict is declared as OrderedDictionary _dict = new OrderedDictionary();
}

Somewhere else in my code I have something similar like this:

public MyObject GetNextObject()
{
  /* In my code keep track of the current index */

  _currentIndex++;
  // check _currentindex doesn't exceed the _questions bounds
  return _dict[_currentIndex] as MyObject;
}

Now my question is. In the last method I’ve used an index. Imagine _currentIndex is set to 10, but I have also an object with an id of 10. I’ve set the Id as a key.

The Id of MyObject is of type long?. Does this goes wrong?

  • 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-05-14T22:48:56+00:00Added an answer on May 14, 2026 at 10:48 pm

    Updated as I never noticed the OrderedDictionary part! The indexer has an override of either object which will retrieve the value by key, or int which will retrieve the value by index. You would need to cast your index as an object if you are looking to retrieve it by key e.g.

    _dict[(object)_currentIndex] as MyObject;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm considering using this jquery utility as a possible solution, but I want to
I'm considering using mysql's built-in aes_encrypt . I normally use blowfish, but mysql doesn't
I'm considering using an object oriented database in Visual Studio .NET for my web
I am considering using an architecture with just one server which will be Tomcat
I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want
I'm considering using the Google Contacts API for a webapp, but I'm worried that
I'm considering using memcached (at some point) in my application i'm currently developing. Eventually,
I'm considering using Grails for my current project. I have a couple of requirements
I am considering using something like StackFrame stackFrame = new StackFrame(1) to log the
I am considering using ClickOnce for a legacy Windows Forms application. I have several

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.