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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:12:01+00:00 2026-06-18T00:12:01+00:00

For my own amusement and to learn the C# reflection APIs, I’ve been toying

  • 0

For my own amusement and to learn the C# reflection APIs, I’ve been toying with the idea of an useless application built completely out of plugins, such that the only thing done by the main program is to read a config file, and load a plugin that will proceed to load every other assembly it’s been configured to load on the fly.

To do this, I was thinking of using attributes to define (…)services(?) and events (for the sake of argument, let’s call them ServiceAttribute(string) EventAttribute(string), where the parameter is the name of the hook), and then keep a table of where we can find these. An example would be like this

namespace example{
  public class Plugin : IPlugin{
    [Service("myService")]
    public void PrintFrickingEverything(params string[] toPrint){
      foreach(string s in toPrint){
        Console.WriteLine(s);
      }
    }
  }
}

And the hook would be accessed somehow by asking for “example.Plugin.myService”

However, a couple of things stick in my head,

one: this implementation seems to be Martin Fowler’s service locator pattern, which I think it couples things too tightly together, and would rather avoid it if possible.

two: While I’ve done something similar to make a dispatcher for plugins in PHP, the type safety in C# makes this approach difficult.

I know I could use MS’s library for this kind of thing, but I want to build this from the ground up by myself so I can learn about it along way to help me with other things I want to write later on.

Anyway, tl;dr: I want to get past the typing system somehow and be able to keep these methods somewhere, yet still be able to call them without needing to resort to casting an array of objects. Is it possible?

  • 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-18T00:12:02+00:00Added an answer on June 18, 2026 at 12:12 am

    YES.
    What you are trying to do is how we did plugins years ago, and it works okay. Nowadays we have MEF to do it, however to learn I recommed taking a look at this: http://www.codeproject.com/Articles/6334/Plug-ins-in-C

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

Sidebar

Related Questions

This is a project I'm doing for my own amusement. I started out wanting
Just tooling around for my own amusement, and I want to use a lambda,
If for no other reason than for my own amusement, I wish to write
As an exercise, and mostly for my own amusement, I'm implementing a backtracking packrat
Background: I am writing a toy Lisp interperter/compiler in Haskell for my own amusement/edification.
For my own personal amusement, I'm writing what I hope will be the foundation
I own a legacy python application written as CGI. Until now this works OK,
I own a server running whm / cpanel, and I have recently been experimenting
I own a Rails application with Unicorn as Web server. I deploy it by
For the sake of my own amusement, I decided to try writing a batch

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.