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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:17:49+00:00 2026-05-10T17:17:49+00:00

What I have now (which successfully loads the plug-in) is this: Assembly myDLL =

  • 0

What I have now (which successfully loads the plug-in) is this:

Assembly myDLL = Assembly.LoadFrom('my.dll'); IMyClass myPluginObject = myDLL.CreateInstance('MyCorp.IMyClass') as IMyClass; 

This only works for a class that has a constructor with no arguments. How do I pass in an argument to a constructor?

  • 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-10T17:17:50+00:00Added an answer on May 10, 2026 at 5:17 pm

    You cannot. Instead use Activator.CreateInstance as shown in the example below (note that the Client namespace is in one DLL and the Host in another. Both must be found in the same directory for code to work.)

    However, if you want to create a truly pluggable interface, I suggest you use an Initialize method that take the given parameters in your interface, instead of relying on constructors. That way you can just demand that the plugin class implement your interface, instead of ‘hoping’ that it accepts the accepted parameters in the constructor.

    using System; using Host;  namespace Client {     public class MyClass : IMyInterface     {         public int _id;         public string _name;          public MyClass(int id,             string name)         {             _id = id;             _name = name;         }          public string GetOutput()         {             return String.Format('{0} - {1}', _id, _name);         }     } }   namespace Host {     public interface IMyInterface     {         string GetOutput();     } }   using System; using System.Reflection;  namespace Host {     internal class Program     {         private static void Main()         {             //These two would be read in some configuration             const string dllName = 'Client.dll';             const string className = 'Client.MyClass';              try             {                 Assembly pluginAssembly = Assembly.LoadFrom(dllName);                 Type classType = pluginAssembly.GetType(className);                  var plugin = (IMyInterface) Activator.CreateInstance(classType,                                                                      42, 'Adams');                  if (plugin == null)                     throw new ApplicationException('Plugin not correctly configured');                  Console.WriteLine(plugin.GetOutput());             }             catch (Exception e)             {                 Console.Error.WriteLine(e.ToString());             }         }     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer $('table').prepend('<tr><td>something3</td><td>else here3</td></tr>'); or... $('<tr><td>something3</td><td>else here3</td></tr>').prependTo('table'); More info on 'prepend': http://docs.jquery.com/Manipulation/prepend… May 11, 2026 at 11:09 am
  • added an answer I just ran a check and verified the problem. It… May 11, 2026 at 11:09 am
  • added an answer I would suggest reading the Wikipedia entry on the history… May 11, 2026 at 11:09 am

Related Questions

What I have now (which successfully loads the plug-in) is this: Assembly myDLL =
I have a table User which has an identity column UserID , now what
SpousesTable SpouseID SpousePreviousAddressesTable PreviousAddressID , SpouseID , FromDate, AddressTypeID What I have now is
So what I have right now is something like this: PropertyInfo[] info = obj.GetType().GetProperties(BindingFlags.Public);
What I have is following: <xsl:variable name=myvar select=.//spss:category[((not @varName) or @varName=$colVarName) and @text=$series]/spss:cell/@text/> What
What I have: LINQ to SQL auto generated class, which corresponds to the shape
What I'm doing is I have a full-screen form, with no title bar, and
From what I have read best practice is to have classes based on an
Below I have a very simple example of what I'm trying to do. I
I have implemented what I thought was a pretty decent representation of MVC in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.