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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:52:19+00:00 2026-06-05T09:52:19+00:00

I create a Class Library project and I build it.now i copy the Dll

  • 0

I create a Class Library project and I build it.now i copy the Dll to “C:\”.Now i want to open this Dll with reflection:

using System.Reflection;

        byte[] assem = System.IO.File.ReadAllBytes(@"c:\Company.dll");
        var loadedAssem = Assembly.Load(assem);
        Type thePersonType = loadedAssem.GetType();
        var theObj = loadedAssem.CreateInstance("Company.Person");
        // or  var theObj = loadedAssem.CreateInstance("Company.Person")as IPlugin ;
        Type[] paramTypes = new Type[1];
        paramTypes[0] = Type.GetType("System.String");
        MethodInfo PersonInfo = thePersonType.GetMethod("FullName", paramTypes);
        Object[] parameters = new Object[1];
        parameters[0] = "Mr. ";
        Object returnVal = PersonInfo.Invoke(theObj, parameters);
        MessageBox.Show(returnVal.ToString());

I cant Invoke my “FullName” method.
this is my Interface:

public interface IPlugin
{
    String FullName(String PreName);
}

and this is my Person Class in my DLL:

public class Person:IPlugin
{
    public int PersonID { get; set; }
    public String PersonName { get; set; }
    public String PersonLName { get; set; }
    public String FullName(String PreName)
    {
        return PreName+this.PersonName + this.PersonLName;
    }
}
  • 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-05T09:52:21+00:00Added an answer on June 5, 2026 at 9:52 am

    I solve the problem with this code.and we shold to use interface “IPlugin” in a seperate class library and use in other project.

            Assembly objAssembly = Assembly.LoadFrom("Company.dll");
            Type objAssemblyType = objAssembly.GetType();
    
            foreach (Type type in objAssembly.GetTypes())
            {
                if (type.IsClass == true)
                {
                    var classInstance = objAssembly.CreateInstance(type.ToString()) as IPlugin;
                    lblFullName.Text = classInstance.FullName("Mr. ");
    
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to build a .dll created from a class library in ASP.NET
Here's what I'd like to do: I want to create a library project that
I have created a class library as a project. Where I have added a
When I'm building a class library I usually create a file Enums.cs to hold
I have created a Class Library (Core Processing Component) using C# in Visual Studio
I wrote a custom class library for NUnit unit tests. It created a dll
I am using the apache library. I have created a class which sends a
I have a class library project which uses a namespace (e.g., Cosmos.Creator.Util). I then
I am in the middle of (trying) to create a Class Library available for
I built a project as descripted in this URL: http://msdn.microsoft.com/en-us/library/ms734784.aspx I used the app.config

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.