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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:53:36+00:00 2026-06-18T05:53:36+00:00

I have a method in Base class which calls ( by reflection to another

  • 0

I have a method in Base class which calls ( by reflection to another method).

  type.InvokeMember(context.Request["MethodName"],
                    System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, 
                    null, 
                    this, 
                    new object[] { context, Jobj });   //  jObj is dynamic

jObj parameter type is dynamic ( can’t change this type).

if the MethodName string value is : "getFinanceDetails" so that method is called..

void getFinanceDetails(object contextObj, dynamic obj)
{

  //Here I need to do obj["Inv_num"].ToString().Decrpyt()   ( my extension method).
  //but it goes Bang cause I cant use extension method for dynamic.
  //But I cant also send it decrypted from base cause not all values are encrpyrted.

}

However – I did solve it by using (inside the method):

((object) obj["Inv_num"]).ToString().Decrypt();

But I dont want to cast every time to object , just to enable extension method.

Is there anything I can do with the param type sending to fix it ?

my desire :

I want to be able to do : obj.ToString().Decrpyt() obj["Inv_num"].ToString().Decrpyt()

edit

   public static string Decrypt(this string obj)
        {
            Func<string, string> Decrypt = Encryptions.GetDecryptedCode;
            return Decrypt(obj);

        }
  • obj ( in this case is IDictionary<string , object>) .
    so I should be able to read properties. (inv_num in this sample.
  • 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-18T05:53:37+00:00Added an answer on June 18, 2026 at 5:53 am

    Assuming obj["Inv_num"].ToString() already returns the right value, you could easily do it in two steps:

    string text = obj["Inv_num"].ToString();
    var decrypted = text.Decrypt();
    

    To be honest, it’s not clear why getFinanceDetails (which should be changed to follow .NET naming conventions) can’t be written as:

    void getFinanceDetails(object contextObj, IDictionary<string, object> obj)
    {
        var decrypted = obj["Inv_num"].ToString().Decrypt();
    }
    

    Do you ever need to call it with something that doesn’t implement IDictionary<string, object>?

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

Sidebar

Related Questions

Here's the situation. I have a base class which implements a method that accepts
The problem: I have a class which contains a template method execute which calls
I have an abstract method in a base class declared like so... public abstract
In my base class I have a generic method (ideally this would be a
I have a PHP class with a method. In the base class (it's more
I have created a gem that adds a new method to the class ActiveRecord::Base.
I have an ActiveRecord before_save method throwing an odd error: class MyThing < ActiveRecord::Base
I have a Model PromoCode which has a .generate! method, that calls .generate which
Let's say I have a class Base with a single member message (String). Another
I have a class called EventConsumer which defines an event EventConsumed and a method

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.