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

The Archive Base Latest Questions

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

I extend Dynamic.cs to qualify it for usage with indexers. In this scenario I

  • 0

I extend Dynamic.cs to qualify it for usage with indexers. In this scenario I need to get the index, which is stored in a call expression. In the debugger, I can see:

 -      left    {Param_0.get_Item(0)}   System.Linq.Expressions.Expression {System.Linq.Expressions.InstanceMethodCallExpressionN}
    -   Arguments   Count = 1   System.Collections.ObjectModel.ReadOnlyCollection<System.Linq.Expressions.Expression> {System.Runtime.CompilerServices.TrueReadOnlyCollection<System.Linq.Expressions.Expression>}
        -   [0] {0} System.Linq.Expressions.Expression {System.Linq.Expressions.ConstantExpression}
            CanReduce   false   bool
            DebugView   "0" string
            NodeType    Constant    System.Linq.Expressions.ExpressionType
            + Type  {Name = "Int32" FullName = "System.Int32"}  System.Type {System.RuntimeType}
            Value   0   object {int}
    +   Rohdatenansicht     

What I want is:

left.Arguments[0].Value

How can I get this?

An ugly method will be perhaps to use left.ToString(). This will result in: “Param_0.get_Item(0)” There I can extract the parameter of get_Item(). But I think this is not the right way.

  • 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-29T22:55:20+00:00Added an answer on May 29, 2026 at 10:55 pm

    To get to that value, you just need to cast the expressions to the right types:

    Expression left = …
    
    var methodCall = (MethodCallExpression)left;
    
    var constant = (ConstantExpression)methodCall.Arguments[0];
    
    int value = (int)constant.Value;
    

    Alternatively, you can use dynamic:

    dynamic dynamicLeft = left;
    
    int value = dynamicLeft.Arguments[0].Value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How else could i access this class, i need my dynamic ID for something
I have a class which I need to use to extend different classes (up
I need to extend this regex to remove space characterless. We use ASP.NET validation
I'm trying to extend my ActiveRecord class with some dynamic methods. I would like
I want to extend a WPF application with database functionality. Which database engine would
There is a requirement to have not-so-trivial dynamic list, each record of which consists
I'm trying to extend this class template <class T> class dynamic_array This does not
I have the need to extend instances of various types at runtime. Most of
Starting with one Java base-interface, I want others to be able to extend this
Im using the jQuery dynamic form plugin , but i need support for nested

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.