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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:44:46+00:00 2026-05-24T10:44:46+00:00

I have implemented my own event registration for a client-server UI framework, much like

  • 0

I have implemented my own event registration for a client-server UI framework, much like in ASP.NET. I store an event’s name (e.g. “Click“) in a dictionary and as the value I remember

oEventHandler.Method.DeclaringType.AssemblyQualifiedName.ToString() + "." + oEventHandler.Method.Name.

Then to reinvoke the event handlers later on, I recreate the delegate:

var oEventHandler = Delegate.CreateDelegate( typeof( BLUIEventHandler ), oPage, sEventMethod, false )

and invoke it on the page:

oEventHandler.Invoke( oPage, this, oEventArgs );

This works fine for event handlers that are part of the ASPX page, like

var oTheButton = new UIButton();
oTheButton.Click += this.HandleClick;
private void HandleClick() {}

but fails for anonymous delegates:

var oTheButton = new UIButton();
oTheButton.Click += delegate {/* Will never be called. */};

The resulting string for a non-anonymous delegate is:

"MyTest.Rene.UI.Foo, BDRS, Version=8.10.1.19703, Culture=neutral, PublicKeyToken=null.HandleClick"

For an anonymous delegate it is:

"MyTest.Rene.UI.Foo+<>c__DisplayClass1, MyTest, Version=8.10.1.17866, Culture=neutral, PublicKeyToken=null.<OnInitializeLayout>oTheButton__0"

However when I try to recreate the anonymous delegate, I get a binding error.
Is there a way to get back to the anonymous delegate and invoke it?

  • 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-24T10:44:47+00:00Added an answer on May 24, 2026 at 10:44 am

    That is never going to work for the general case of anonymous methods, since there is a very good chance that there are captured variables involved, and you will not know the values to capture (plus you have changed the nature: the original closure could update the captured variables – they aren’t isolated copies).

    Personally, I think you should store the Delegate instance – not the name. EventHandlerList is a typical way of implementing this (along with unique object keys per event).

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

Sidebar

Related Questions

I have implemented my own form field as IsEditor<LeafValueEditor<String>> that I'd like to use
I have implemented my own RingBuffer , but I'm surprised to see that .NET
Description: On a C# ASP.Net web application, we have implemented some timers to periodically
I have an own Tree object implemented in PHP. Say we have a tree
I have implemented an "unsaved changes" warning using techniques described on these pages: Client/JS
I have an ASP.NET MVC application, with some RESTful services that I'm trying to
I'm developing an Asp.net (MVC but this doesn't really matter) application. I have a
I have a Server class that upon accepted a TcpClient, raises an event whose
I have implemented my own manual method of switching the app's localization within the
I have implemented what I thought was a pretty decent representation of MVC in

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.