C
C#8mo ago
Jason_Bjorn

✅ IL for function vs expression-bodied-function

Why do these two compile to different things?
class Program {
int Double1(int n) => n + n;

int Double2(int n) {
return n + n;
}
}
class Program {
int Double1(int n) => n + n;

int Double2(int n) {
return n + n;
}
}
10 Replies
reflectronic
reflectronic8mo ago
they do not in release mode
Jason_Bjorn
Jason_BjornOP8mo ago
Oh, you're right interesting
reflectronic
reflectronic8mo ago
in debug mode they are different so that you can set a breakpoint/step onto on the braces
Jason_Bjorn
Jason_BjornOP8mo ago
Appreciate it @reflectronic !close
reflectronic
reflectronic8mo ago
$close
MODiX
MODiX8mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Jason_Bjorn
Jason_BjornOP8mo ago
No description
Jason_Bjorn
Jason_BjornOP8mo ago
something's broken
reflectronic
reflectronic8mo ago
hm seems unfortunate
Servator
Servator8mo ago
You could try
/close
/close

Did you find this page helpful?