✅ 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
Angius3mo ago
Sharplab can tell you what gets lowered into what
Ryan Chen
Ryan Chen3mo 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
Angius3mo ago
To answer your questions, though: * yes * yes * no
SleepWellPupper
SleepWellPupper3mo 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
Angius3mo ago
Something like that, yeah
Ryan Chen
Ryan Chen3mo ago
Yes, This is exactly what they do, and ILSpy can also specify the corresponding version.
SleepWellPupper
SleepWellPupper3mo ago
The corresponding compiler version?
Ryan Chen
Ryan Chen3mo ago
Language version.
SleepWellPupper
SleepWellPupper3mo ago
Right. Thanks guys.
Want results from more Discord servers?
Add your server