

How many keywords I can fit into a single C# expression?
source link: https://www.tuicool.com/articles/hit/QFNZfaj
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

As I was playing few days ago with
“ yield return await
“
I got an idea to try fit as much “keywords” as possible into one “expression”. I mean as much blue words (in Visual Studio’s default colors) as possible together (not separated by semicolon, comma, colon, bracket, etc.).
Obviously yield return await
gives us 3 together. One can also do yield return this
, yield return base
or yield return sizeof(...)
. But that’s still just 3. Can I do more? While I was waiting for my car on a yearly checkup, hence I was not mindlessly wasting time, I came up with 7.
class C { async Task Test() { switch (this) { case null when await this is false: break; } } public System.Runtime.CompilerServices.TaskAwaiter<bool?> GetAwaiter() => default; }
The case null when await this is false
is the answer. At this point I ran out of time as I received a message from garage that my car is ready. Maybe you
can come up with even longer solution and I’m eager to see it.
Recommend
-
11
Wading Back into RSS Nerdery After So Many Years Oct 16, 2019 It is with no small amount of personal trepidation tha...
-
12
you can take the derivative of a regular expression?! And it’s actually useful?! Paul Wankadia sent me an email yesterday about regular expressions and I thought it was so interesting I decided to write up...
-
9
How can I get values from Linq Expression? advertisements I have a method that takes Expression type parameter, in my method i want to get v...
-
6
I Work In Porn. I Know Why So Many Men Are SingleA look into the frustrating world of dating as a man.Photo by Brooke C...
-
9
Why do the ordinary laws in the evaluation of Boolean expression do not fit into LINQ? advertisements In such a code:
-
9
You Can Now Search Your Twitter DMs for Specific Keywords By Aya Masango Published 1 day ago Twitter has finally added a...
-
9
April 7, 2022 ...
-
5
Jack Dorsey: Ethereum Has 'Many Single Points Of Failure' 7205 members Technology The latest news, reviews and featu...
-
5
Can we predict a pathway status using gene expression?. Can we predict a pathway status using gene expression? By
-
2
How Many People Can Fit Into SpaceX's Starship?
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK