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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:00:47+00:00 2026-06-07T13:00:47+00:00

I have a delegate function class FuncActivator { public delegate void DelFunc(string arg, string

  • 0

I have a delegate function

class FuncActivator {
  public delegate void DelFunc(string arg, string val);
}

I keep instances of that function to start at the same time later within the program (Also in FuncActivator:

List<DelFunc> funcList = new List<DelFunc>();

public void KeepFunc(DelFunc delFunc) {
  funcList.Add(delFunc);
}

Now I want to get information about the actual delegate name, or it least which class passed it here. For example, in a different class

public class FunnyClass {
  public void FunnyFunc(string arg, string val) {
    //..Do stuff
  }

  public FunnyClass () {
    FuncActivatorInstance.KeepFunc(FunnyFunc);
  }
}

I’d like from a method within FuncActivator to list the names or callers of all the delegates in my list (like “FunnyFunc” or at least “FunnyClass”).
Is that possible?

  • 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-07T13:00:48+00:00Added an answer on June 7, 2026 at 1:00 pm

    This code:

    public void PrintFuncs()
    {
        foreach (var func in funcList)
        {
            Console.WriteLine(func.Method.Name);
            Console.WriteLine(func.Method.DeclaringType.Name);
        }
    }
    

    Prints:

    FunnyFunc
    FunnyClass
    

    The instance of FunnyClass that added itself to the list is at func.Target, if you’d like to use that, too.

    Lambdas that are attached, since they are anonymous, will have an auto-generated method name. If a class was generated for it as well, it will have an auto-generated name as well. So just FYI, you won’t always be able to have very readable strings from this.

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

Sidebar

Related Questions

I have two classes, first: public class A { public delegate void Function(); public
When i have delegate like public delegate void PrintMe(); (1) PrintMe a = delegate()
I have this delegate in C#. public delegate string ACSharpDelegate(string message); How would I
let's say I have public delegate DataSet AutoCompleteDelegate( string filter, long rowOffset); can I
I have a class with a delegate declaration as follows... Public Class MyClass Public
I have a function, in UpdateViewController, that is being called by a delegate, MyDownloadController,
I have a user defined class that I want to create a public List
I'm just beginning understanding delegates, I have a class that implemens IDisposable: public class
I have a class called Foo that has a function that looks like the
In my main class 'A' I have declared a function and delegate to call

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.