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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:12:10+00:00 2026-05-18T10:12:10+00:00

I have an application that loads plugins. I have a plugin that has complete

  • 0

I have an application that loads plugins. I have a plugin that has complete access to a form instance. If I have a function in a form that needs to be overridden, but is not a virtual function, is there another way to override it?

Here is a very generic example:

//Form I am modifying
public partial class MyForm : Form
{
    public int myVariable1;
    public int myVariable2;

    //Constructor and other methods here

    private void setVar(int replacementValue)
    {
        myVariable1 = replacementValue;
    }
}

…then in a separate dll…

//My plugin
public class MyPlugin : IMyPluginBase
{
    MyForm theForm; //Reference to the form in the main application

    //Constructor and other methods here

    private void setVar(int replacementValue)
    {
        theForm.myVariable2 = replacementValue;
    }
}

In this example the function in the form sets ‘myVariable1’, but the ‘setVar’ function in the plugin sets ‘myVariable2’.

So, the question is, in the case of this example, can I replace/override the form’s ‘setVar’ function with the one in the plugin? Maybe with messages or reflection?

  • 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-18T10:12:11+00:00Added an answer on May 18, 2026 at 10:12 am

    No. You cannot “replace” or overide private non-virtual methods in C#.

    The C# language (and .NET runtime) don’t support dynamic replacement of methods in the manner you describe. Very few languages support this capability, to my knowledge (I believe that SmallTalk and Objective-C both do).

    If this is the only place in your application where you need this kind of extensibility, you can achieve it through an interface, delegate, or inhertance+virtual methods. Any of these approaches could work … which one you choose depends on what kind of extensibility you desire.

    If you expect to have many such extensibility points in your app, then you should probably take a look at the Managed Extensibility Framework (MEF). It provides a Microsoft-supported model for creating plug-in architectures using patterns and technique that work well in .NET.

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

Sidebar

Related Questions

I have a a C# (FFx 3.5) application that loads DLLs as plug-ins. These
I have an application that loads external SWF files and plays them inside a
I have a managed Windows application that loads a managed C++ component that uses
I have a web application that dynamically loads assemblies based on database configuration entries
I have to develop a .NET C# application that supports plugins. I’ve found a
I have a application that uses plugins. I load the plugins in another appdomain.
I have an GUI application that takes a while to load all its plugins,
We have an application that runs over load balanced server instances, and therefore is
I have an application that sends messages to an external web service. I build
I have an application that displays an image inside of a Windows Forms PictureBox

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.