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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:47:29+00:00 2026-06-11T17:47:29+00:00

Multicast Delegates must have a return type of void Otherwise it will throw an

  • 0

Multicast Delegates must have a return type of void Otherwise it will throw an exception.

I want to know whats the reason behind it, what if multiple methods could have a same return type as of a delegate ?

  • 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-11T17:47:30+00:00Added an answer on June 11, 2026 at 5:47 pm

    The premise is wrong; it works fine:

    Func<int> func = delegate { Console.WriteLine("first part"); return 5; };
    func += delegate { Console.WriteLine("second part"); return 7; };
    int result = func();
    

    That is a multicast delegate with a non-void result, working fine. You can see from the console that both parts executed. The result of the last item is the one returned. We can demonstrate that this is a true multicast delegate:

    if(func is MulticastDelegate) Console.WriteLine("I'm multicast");
    

    and it will write “I’m multicast” even after just the first line (when there is only a single method listed).

    If you need more control over individual results, then use GetInvocationList():

    foreach (Func<int> part in func.GetInvocationList())
    {
        int result = part();
    }
    

    which allows you to see each individual result.

    In IL terminology:

    .class public auto ansi sealed Func<+ TResult>
        extends System.MulticastDelegate`
    

    which is to say: Func<T> inherits from MulticastDelegate. Basically, to all intents and purposes, all delegates in .NET are multicast delegates. You might be able to get a non-multicast delegate in managed C++, I don’t know. But certainly not from C#.

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

Sidebar

Related Questions

I want to know how do I go about removing individual delegates from the
When is it useful to have multicast delegates over singlecast delegates? I use delegates
I want to set the endpoint specific header value in Multicast component. XML DSL
I have a udp client that is listening for multicast messages. When it gets
I have some networking code which connects to a multicast address but disconnects after
I would like to understand whats the best way to handle exceptions in Multicast
I want to create a method like this: private static void AddOrAppend<K>(this Dictionary<K, MulticastDelegate>
I want to create a Comparison<>-Delegate via reflection in code. I have this: var
I have a multicast receive daemon that is running as a NSThread. While it's
I want to code a minimal multicast delegate class. Its interface consists of the

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.