+= Operator in reflector?
Pregunta
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 ?
Solución
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.
Otros consejos
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.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow