Operator += what/where is it?

  • Thread starter Thread starter Julie
  • Start date Start date
J

Julie

Does the += operator decompose to:

op_Addition
op_Assign

I don't see a specific operator for +=, and searching Google doesn't reveal
anything (probably because it is a screwy search term).

???
 
Julie said:
Does the += operator decompose to:

op_Addition
op_Assign

I don't see a specific operator for +=, and searching Google doesn't reveal
anything (probably because it is a screwy search term).

???

Found it. There is an operator:

op_AdditionAssignment

One chart in the online help doesn't include this, another does. News alert:
C# help sucks.
 
x += y

in C# is defined as:

x = x + y

See 7.13.2 of the spec for more information. There are few subtleties around
implicit explicit casts.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://weblogs.asp.net/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Eric Gunnerson said:
x += y

in C# is defined as:

x = x + y

See 7.13.2 of the spec for more information. There are few subtleties around
implicit explicit casts.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://weblogs.asp.net/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.

I was looking for the underlying operator method call -- op_AdditionAssignment
in this case.

I was writing a managed C++ class that needed to provide the += operator, and
it took a little hunting to find the proper op_ method, and then pure guesswork
as to how to implement (the online docs give *nothing* on op_AdditionAssignment
other than it exists).
 
if you could then it would mean that there would be two different calls
made - one, to op_addition and the other to op_assign i.e. if the +
operator were used even then this += will be interpreted if you had
op_addition and op_assign. But, of course, your problem is solved so not
much in discussing but your query started off the above.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
Back
Top