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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:58:15+00:00 2026-05-30T00:58:15+00:00

I have a class library called (service.cs). I have WCF service both are in

  • 0

I have a class library called (service.cs).

I have WCF service both are in the same solution. Here what am trying to do, am trying to call the service class upload.uploading() method from my service contract in wcf and pass the value .

namespace MyService
{
    class MyService : IServiceContract
    {
        public void Insert(string Name)
        {
            if (core == true)
            {
                Upload(XmlFile);
            }
            else
            {
            }
        }

here is the sample class library file

namespace Service
{
    class upload
    {
        public void Uploading(string file)
        {
        console.writeline(file)
    }
    }
}
  • 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-30T00:58:17+00:00Added an answer on May 30, 2026 at 12:58 am

    Your example isn’t very clear, but I’m guessing you want to call the Upload.Uploading() method that’s in a class library.

    The best way to do that is to create an interface, like this:

    public interface IUploader
    {    
        void Upload (string name);
    }
    

    and have the external class library implement it:

    public class Uploader : IUploader
    {
        public void Upload(string name)
        {
           // Do the logic.
           Console.WriteLine(name);
        }
    }
    

    Now, use this code in your main program:

    public void Insert (string filename)
    {
         var classLib = System.Reflection.Assembly.Load("MyClassLibrary.dll");
         var type = classLib.GetType("MyClassLibrary.Uploader"); //FULL NAME with namespace.;
         IUploader uploader = Activator.CreateInstance(type) as IUploader;
    
         uploader.Upload(filename);
    }
    

    What you’re doing is dynamically loading the class library (line 1), dynamically getting the type of the class in it via reflection (line 2) and creating an instance of it (line 3).

    It’s important to have it implement an interface, like IUploader, which is known to the main program so it knows how to handle it, how to call its Upload() method, etc.

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

Sidebar

Related Questions

I have created a class library called AddServiceLibrary in which I have a method
I have a Class library with WCF service added. When I click on command
I'm trying to develop a WCF service in the following manner: A class library
I can not work this out. I have a class library called 'ABC.Service'. In
My Scenario I have a class library that is going to be called from
I have a class (called Employee. non static) defined in a class library. I
I have a class library (.NET) with a reference to a web service (in
I have a Class Library project and MVC project in the one solution. My
In Visual Studio 2008 I have a Class Library project (called Media ) to
I have a serializable POCO called DataUnification.ClientData.ClientInfo in a .NET class library project A

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.