✅ What is C# Code Lowering?

Is there a cut and dry definition of what code lowering ("yoinking") encompasses? e.g.: - are top level statements "lowered" into a class/function? - are records "lowered" into class definitions? - are properties "lowered" into methods? Generally asking: What is code lowering in C#, where can I observe it or its effects in my code, and where can I read more about it? Thanks in advance!
9 Replies
Angius
Angius5mo ago
Sharplab can tell you what gets lowered into what
Ryan Chen
Ryan Chen5mo ago
1. Website: sharplab.io 2. ILSpy from Github: https://github.com/icsharpcode/ILSpy
GitHub
GitHub - icsharpcode/ILSpy: .NET Decompiler with support for PDB ge...
.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform! - icsharpcode/ILSpy
Angius
Angius5mo ago
To answer your questions, though: * yes * yes * no
SleepWellPupper
SleepWellPupperOP5mo ago
Thanks for the replies so far. Can I infer then that code lowering is simply the C#->C# transformation the compiler performs before actually compiling?
Angius
Angius5mo ago
Something like that, yeah
Ryan Chen
Ryan Chen5mo ago
Yes, This is exactly what they do, and ILSpy can also specify the corresponding version.
SleepWellPupper
SleepWellPupperOP5mo ago
The corresponding compiler version?
Ryan Chen
Ryan Chen5mo ago
Language version.
SleepWellPupper
SleepWellPupperOP5mo ago
Right. Thanks guys.
Want results from more Discord servers?
Add your server