Decompiling the New C# 14 field Keyword
blog.ivankahl.com
Decompiling the New C# 14 field Keyword
1–10 of 37 posts
Re: Decompiling the New C# 14 field Keyword
#2In the EF Core and Automapper type of cases, I consider it an anti-pattern that something outside the class is taking a dependency on a private member of the class in the first place, so the compiler is really doing you a favor by hiding away the private backing field more obscurely.
Re: Decompiling the New C# 14 field Keyword
#3The only winning move is not to play. Mapping libraries, even with source generators, produce lots of bugs and surprising behavior. Just write mappers by hand.
Re: Decompiling the New C# 14 field Keyword
#4> If you want to avoid this issue altogether, consider using a source generator library like Mapster. That way, mapping issues can be caught at build time rather than at runtime. The only winning move is not to play. Mapping libraries, even with source generators, produce lots of bugs and surprising behavior. Just write mappers by hand.
Re: Decompiling the New C# 14 field Keyword
#5Re: Decompiling the New C# 14 field Keyword
#6Re: Decompiling the New C# 14 field Keyword
#7All of the caveats basically boil down to "if you need to access the private backing field from anywhere other than the property getter/setter; then be aware it's going to have a funky non C# compliant field name". In the EF Core and Automapper type of cases, I consider it an anti-pattern that something outside the class is taking a dependency on a private member of the class in the first place, so the compiler is re…
Re: Decompiling the New C# 14 field Keyword
#8How does C# the language or C# the language standard evolution process accommodate a new keyword with such a generic name? Is it context-dependent?
Re: Decompiling the New C# 14 field Keyword
#9How does C# the language or C# the language standard evolution process accommodate a new keyword with such a generic name? Is it context-dependent?
That said, they will also throw compiler warnings in console during build if you are using an all lowercase word with some small number of characters. I don't remember the exact trigger or warning, but it says something like "such words may be reserved for future use by the compiler" to disincentivize use.
Re: Decompiling the New C# 14 field Keyword
#10How does C# the language or C# the language standard evolution process accommodate a new keyword with such a generic name? Is it context-dependent?