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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:58:59+00:00 2026-05-17T18:58:59+00:00

I have a dictionary that is like this: Dictionary<string, object> myDictionary = new Dictionary<string,

  • 0

I have a dictionary that is like this:

Dictionary<string, object> myDictionary = new Dictionary<string, object>();

When I get data out of it, I am doing it like this:

myDictionary["IndexingValue"]

Most of the time that is working. But I just changed one of the values that it stores to be null. Now when I do that same call (expecting null) I get and exception. When I put it in the debugger it says “Could Not Evaluate Expression”.

So I said to my self, “OK, somehow my IndexingValue is not in the dictionary. But I went and looked at myDictionary.entries and sure enough it is there.

What I want to do is something like this:

if (myDictionary["IndexingValue"] != <Could not evaluate expression>)
{
    //do some logic.
}

(IE find some way to know when the expression can not be evaluated with out having to throw an exception.)

Can this be done?

  • 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-17T18:59:00+00:00Added an answer on May 17, 2026 at 6:59 pm

    You can use

    if (myDictionary["IndexingValue"] != null)
    {
        //do some logic.
    }
    

    to check whether the item is null or not. As for the “Could Not Evaluate Expression” it’s just a debugger output when it cannot for some reason get the value of the item so as long as the dictionary contains the given key it you will not get such error during runtime. To check if the key is in dictionary you can use ContainsKey method.

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

Sidebar

Related Questions

Say that i have a generic dictionary with data like this (I hope the
I have a dictionary that looks like this Dictionary<string,string[]> I also have 2 dropdownlist.
Suppose I have Dictionary like this: Dictionary<string, string> values = new Dictionary<string, string>() {
I have dictionary that is defined as: Dictionary<string, object> d = new Dictionary<string, object>();
I have an object that looks like this: class Model { public string Category
I have data in a python dictionary that I'd like to store in a
I have a message definition file that looks like this struct1 { field=name type=string
I have a dictionary object Dictionary<string, Type> dict = new Dictionary<string, Type>(); I also
I have a JSON string (from PHP's json_encode() that looks like this: [{id: 1,
I have this Class which is accepting a Dictionary<string,object> which is been invoked from

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.