+= Operator in reflector?
Question
Im trying to find the +=
in reflector
in order to see how they implemented :
a=+1
vs a=a+1
but I cant find it.
any help ?
Solution
There is no implemetation for the +=
operator anywhere, it's a pseudo operator that is handled by the compiler. The C# compiler expands a += 1
into a = a + 1
.
The JIT compiler then creates the most efficient code to do the a = a + 1
. If it's a simple variable it will just be an instruction that increases the value.
OTHER TIPS
If you mean the +=
for int
and the other built-in numerical types: there won't be a library function to look at. The compiler can translate them directly into IL instructions.
You could try the DateTime
struct, and maybe Decimal
as well.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow