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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:58:13+00:00 2026-05-11T03:58:13+00:00

How do I escape the dot in the indexer? The first DataBinder.Eval works as

  • 0

How do I escape the dot in the indexer? The first DataBinder.Eval works as expected. The second throws an exception.

System.ArgumentException: DataBinding: 'dict['a' is not a valid indexed expression.   Dictionary<string, int> dict = new Dictionary<string, int>(); dict.Add('aaa', 111); dict.Add('bbb', 222); dict.Add('ccc', 333); dict.Add('ddd', 444); dict.Add('a.aa', 555); var blah = new { dict = dict, date = DateTime.Now };  Console.WriteLine(DataBinder.Eval(blah, 'dict[\'aaa\']'));  // 111  Console.WriteLine(DataBinder.Eval(blah, 'dict[\'a.aa\']'));  // System.ArgumentException: DataBinding: 'dict['a' is not a valid indexed expression. 
  • 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-11T03:58:14+00:00Added an answer on May 11, 2026 at 3:58 am

    DataBinder.Eval first splits a string up by expression parts via a set array of char tokens (which it defines in a static constructor as):

    expressionPartSeparator = new char[] { '.' }; 

    It then passes these parts into a private Eval method that will either use DataBinder.GetPropertyValue or DataBinder.GetIndexedPropertyValue as needed to further determine the value of the expression.

    To bypass this, just use GetIndexedPropertyValue directly with your string expression like so:

    Console.WriteLine(DataBinder.GetIndexedPropertyValue(blah, 'dict[a.aa]' )); 

    Also note that you don’t need the extra quotes… they are overkill.

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

Sidebar

Related Questions

the cgi.escape section (below) throws traceback in dev server, but when I comment out
I would like to learn how to escape dot in GString so groovy (1.8)
How do I escape a dot in insert query? insert into './$x/.' () lues(
Escape characters cause a lot of trouble in R, as evidenced by previous questions:
cgi.escape seems like one possible choice. Does it work well? Is there something that
I have to escape some inputs on a form. I used mysql_real_escape_string to escape
I'm trying to escape a RegExp metacharacter in Java. Below is what I want:
How do I escape the & in the app settings? I've tried \ but
I need to escape just part user input for output. For example Hey a
How can I escape certain characters in a string with a C# Regex? This

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.