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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:10:49+00:00 2026-06-13T16:10:49+00:00

I’m dealing with an API, that has a class of million methods, I know

  • 0

I’m dealing with an API, that has a class of million methods, I know what these methods do, they’re just proxies to a web-service.

The API internally calls these proxy methods using reflection invoking the appropriate method name (don’t ask me why it’s done this way).

There are methods in the web-services not implemented by the API, and I need to ‘inject’ these proxy methods dynamically.

So my question is: How can I add methods to an existing class (not extension methods)?

I could do this by Reflection.Emit, but I don’t know MSIL.
Anyway I’m mentioning it, because I’ve made another class that inherits from the same base class as the API does, and implemented the methods there, so maybe there is a way to copy the methods to the API class, because they only call methods of the base class which refers to the same one.

  • 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-13T16:10:50+00:00Added an answer on June 13, 2026 at 4:10 pm

    Realistically, there’s no way you’re going to modify an existing class in the way you want. Even using Reflection.Emit, it won’t do what you want because the API is calling a specific type, and you can’t modify the definition of a type during runtime. What you can do with Reflection.Emit is define a type that inherits from the proxy, but getting the API to load your inherited type will probably prove to be impossible unless they’re using a dependency injection framework, which seems unlikely.

    The only real way to do this is to go in and modify the bytecode of the dll using decompilation and recompilation. This is how Postsharp does AOP, but imo, I’d never do this for any other reason.

    If you have any access to this code or even their libraries, then there is probably a better way around your problem.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I know there's a lot of other questions out there that deal with this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a small JavaScript validation script that validates inputs based on Regex. I

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.