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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:32:40+00:00 2026-06-13T11:32:40+00:00

I have referenced one DLL (I have source code of this) say Dll_A in

  • 0

I have referenced one DLL (I have source code of this) say Dll_A in which there is a function

private void uploadPic(int a)

In my main project, I have a function say

private void passMe(int b)
{
}

I need to pass the above function (passMe) to uploadPic function in Dll_A, how can I do that? Is it possible?
I am able to use functions of the Dll_A from my main project, so instantiating isn’t a problem, I just need a way to pass function.

===
Thanks, giving it a try. If some can edit code below

//code in main project  picbackman.cs
public delegate void delObj(int v);
private void uploadSome(string path, string fName, string str)
{
delObj del1 = new delObj(updatePValue);
UploadFileResponse response =  boxProvider1.UploadFiles(args1, folderString, ((Picbackman.BoxProvider.delObj)( del1)));
}
//code in different dll which is referenced in main project //Dll_A                     

public delegate void delObj(int v);
public UploadFileResponse UploadFiles(string[] filePathes,string folderId, delObj d)
{}
  • 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-13T11:32:40+00:00Added an answer on June 13, 2026 at 11:32 am

    First of all your method will need to accept a delegate as one of it’s parameters. That would be something like

    private void uploadPic(Action<int> func,int a){
       //at some point do func(someInt);
    }
    

    at another point declare anothe method or function

    public class someClasse {
       public vois passMe(int b){
      ...
      }
    }
    

    First of all notice that the access modifier has changed. if they are not in the same class you will need to be able to access one from the other so they can’t both be private and since they are in different assemblies internal won’t work either.

    when you need the delegate do like this

    var obj = new someClass();
    var myInt = 5; //or whatever the value is
    uploadPic(obj.passMe,myInt);
    

    notice that the method is used with out arguments. When using a method without arguments the compiler will try and convert it to a suitable delegate.

    I’d recommend you not to use delegate but stick with Func/Action they are delegates but more generic

    public delegate void DelObj1();
    public delegate void DelObj2()
    
    public void F(){};
    
    var del1 = new DelObj1(F);
    var del2 = new DelObj2(F);
    

    you can’t pass a del1 where a DelObj2 is needed even though you use the same method for each. You will not have that issue if you use Action/Function

    Action del1 = F;
    Action del2 = F;
    

    The reason is that DelObj1 and DelObj2 are two distinct classes with the same base class Ie they are siblings in the type tree. Using Action the type is the same for both del1 and del2

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

Sidebar

Related Questions

I have one project which has RIAService with entity framework that is referenced to
I have one assembly that's created already, say Static.dll , and a dynamic assembly
The following is my code for using Google Translate. I have one dll I
I have a Data class with one field, price. I referenced the price field
Have deployed numerous report parts which reference the same view however one of them
I have referenced both Microsoft.Web.Mvc.dll (MVC Futures 2) and MVCContrib.dll (from MVC Contrib 2),
I have a java project in which I have Referenced Libraries. In the Referenced
I have an application which uses a .dll which is full of gui application
I have multiple native C++ projects, one of them is a dll project, and
I have two references to a SQLite assembly, one for 32-bit and one for

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.