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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:16:52+00:00 2026-05-11T08:16:52+00:00

Say I have the following C# code: Action a = TestMethod; Action b =

  • 0

Say I have the following C# code:

Action a = TestMethod; Action b = TestMethod; Action c = b; b += a; 

Tests indicates that b is not the same instance as c, so clearly the + operator seems to create a new instance of the delegate. Is this a correct assumption? Does it reuse the b-instance internally, or does it just copy the method/target information to a new instance?

I seem to be unable to find the implementation of the + operator for delegates, the Delegate class doesn’t seem to contain it.

Can anyone shed some light on this issue?

The reason I’m asking is that I’m creating some classes that will layer themselves around each other like onions, and the outermost layer will call an inner layer, obtain some delegates and then attach more methods to those delegates, I’m just concerned that doing so will in some way change the delegates I obtain from the inner layer, in which case I need to return copies/clones, instead of just the internal references.

Note that this is wholly internal code to my library, so while I know that passing out internal data structures like that is a bad idea generally, if I can do it safely with these classes, then I will do so.

  • 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. 2026-05-11T08:16:53+00:00Added an answer on May 11, 2026 at 8:16 am

    As Kent says, += uses to Delegate.Combine, and -= uses Delegate.Remove. See my events/delegates article for more information.

    The important thing is that delegates are immutable – calling Combine/Remove doesn’t change the delegate you call it on at all – so you don’t need to clone anything. The same is true for anything else you do with the delegate: if you get the invocation list and change the contents of the returned array, for example, that won’t change what the delegate actually does.

    (This is just like String’s behaviour, if you want another way of thinking about it.)

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

Sidebar

Ask A Question

Stats

  • Questions 105k
  • Answers 105k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should be able to bind a property in you… May 11, 2026 at 8:45 pm
  • Editorial Team
    Editorial Team added an answer The alternative is to build one yourself, but it will… May 11, 2026 at 8:45 pm
  • Editorial Team
    Editorial Team added an answer From MSDN: MethodImplOptions.InternalCall: Specifies an internal call. An internal call… May 11, 2026 at 8:45 pm

Related Questions

I have been playing with the Ruby library shoes. Basically you can write a
I'm implementing a blog with tags with some French characters. My question has to
I've been developing a very large LOB app using my flavor of M-V-VM which
Let's say that I have the following code in application_helper.rb : def do_something if

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.