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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:15:21+00:00 2026-06-09T14:15:21+00:00

I have a dictionary object in Visual Basic which I want to access with

  • 0

I have a dictionary object in Visual Basic which I want to access with string keys. The problem is, Visual Basic is storing references to strings, rather than the strings themselves. So when I index the dictionary with a key, it always fails because the object references are not equal. What is the point of a dictionary I cannot index? How do I solve this?

Edit:

To be more clear, I want to be able to use this more like a Python dictionary, where string keys are immutable types and therefore the contents rather than the object references are compared.

  • 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-09T14:15:22+00:00Added an answer on June 9, 2026 at 2:15 pm

    Strings in .Net ARE immutable. And Dictionary DOES work as you want it to work:

    Dim Store As New Dictionary(Of String, Object)
    
    Store("Key1") = New Form()
    Store("Key2") = New Exception()
    Store("Key3") = 10
    Store("Key4") = "Test"
    
    MessageBox.Show(Store("Key1").GetType().FullName) ' System.Windows.Forms.Form
    MessageBox.Show(Store("Key2").GetType().FullName) ' System.Exception
    MessageBox.Show(Store("Key3").GetType().FullName) ' System.Int32
    MessageBox.Show(Store("Key4").GetType().FullName) ' System.String
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have a dictionary object contains string keys and values, which
I have a string data which I need to parse into a dictionary object.
I have such dictionary Dictionary<string, object> , dictionary holds string keys and objects as
I have a dictionary object IDictionary<string, string> which only has the following items: Item1,
I have a Dictionary object where the Keys are of type string and the
Say you have a Dictionary < string,object > . It might contain decimals, strings
I have created dictionary object Dictionary<string, List<string>> dictionary = new Dictionary<string,List<string>>(); I want to
I have a dictionary object which i would like to encrypt, then put it
I have a simple Dictionary(of String, Object) that I need to iterate through and
I have the following nested dictionaries: Dictionary<int, Dictionary<string, object>> x; Dictionary<int, SortedDictionary<long, Dictionary<string, object>>>

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.