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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:53:45+00:00 2026-05-11T15:53:45+00:00

I am working on a program where I want to be able to add

  • 0

I am working on a program where I want to be able to add functionality using DI, C#, so I will create an example to see if this is possible.

I have a program that a user enters any two numbers. The program then looks at all the plugins in an xml file and uses those classes that are injected to calculate with these two numbers.

So, I create two classes, Add and Subtract. I put them in and run my program.

Ideally, I would like to have the program find these two classes and show the results after going through the equations.

Now, someone else writes ‘Multiply’, drops it into a directory, updates the xml file, and next time I run my program, with two numbers, there are three results.

Now, I don’t know how many plugins there will be.

Is there any way in C#, using DI, that I can get this type of functionality?

I don’t know if it is possible.

I am trying to figure this out as I want to show a way to graph some data, using different types of graphs, but I think using the binary equation approach makes explaining simpler, I think.

I could do this by manually loading the class referenced in the xml file, so it can be done, but, I would like to have a dependency framework take care of the heavy work for me.

Update: I am hoping to use the Unity framework for this.

  • 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-11T15:53:46+00:00Added an answer on May 11, 2026 at 3:53 pm

    You can expose an interface (IMathOperation for example, with a single method such as Compute) and then specify types implementing the interface (Add, Subtract etc) in the DI framework config file. DI frameworks generally allow you to specify the assembly name as well as the type name, and they’re also usually good at allowing you to create collections of similar types, so you could have one type which has a property or constructor parameter of type IList<IMathOperation>. Set that property/parameter in the config file, and you should be good to go.

    The exact details will depend on the DI framework you want to use, of course.

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

Sidebar

Related Questions

Recently I have started working on a program that will monitor the packets of
I am working on a program that needs to create a multiple temporary folders
I'm working on a program that will tell what level a programmer is at
I'm working on a C++ program that will automatically backup my work to my
I'm working on a program that processes many requests, none of them reaching more
I'm working on a program that searches entire drives for a given file. At
I'm working on a program that uses PHP's internal array pointers to iterate along
I am working on a program that encodes a file based on a supplied
I'm currently working on a program that has many of those the user SHOULD
I'm working on a C# program, and right now I have one Form and

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.