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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:38:05+00:00 2026-06-16T17:38:05+00:00

I’m writing on C#. I like using event . It’s very natural for my

  • 0

I’m writing on C#.
I like using event. It’s very natural for my classes to just publish event and don’t care who and how will they process. However as I will need to migrate my code to c++ should I still use event? How easy would be to rewrite such code to c++? Probably it makes sense to use other technics that easier to rewrite to c++?

upd i’ve found similar question C#-like events in C++, Composition

  • 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-16T17:38:07+00:00Added an answer on June 16, 2026 at 5:38 pm

    What to use instead of c# event to have code easy to port to c++?

    If you are sure what you think about is only related to event, then I think you don’t need to make any change.

    Just write a underlying class for event, that reaches your goal.

    You might have various ways to do. The first step would be thinkg about CALLBACKs.

    Here I provide some code for example, invoking c++ callbacks through P-invoke and wrap into delegates in c#.

    Import the callback:

    [DllImport("devlink.dll")]
    static extern int DLRegisterType2CallDeltas(uint pbxh,DLCALLLOGEVENT cb);
    

    Define the delegate:

    public delegate void DLCALLLOGEVENT(uint pbxh, StringBuilder info);
    

    Declare the event:

    public event EventHandler<CallLogEventArgs> CallLogEvent;
    

    Wrap the event to call:

    DLRegisterType2CallDeltas(
        pbxHandle,
        (pbxh, info) => {
            lock(thisLock)
                if(
                    default(EventHandler<CallLogEventArgs>)!=CallLogEvent
                    &&
                    pbxHandle==pbxh
                    )
                    CallLogEvent(this, new CallLogEventArgs(info));
        }
        );
    

    You’d need to do something reversed/inverted in c++. But first of all, implement a class for event or delegate would get you closer to done what you’ve asked.

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

Sidebar

Related Questions

I am using Paperclip to handle profile photo uploads in my app. They upload
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am using JSon response to parse title,date content and thumbnail images and place
I've got a string that has curly quotes in it. I'd like to replace
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only

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.