|
(ref = aside since i haven't used it enough to comment on it)
I think await has been in C# for some time, maybe 6? if I recall? not sure exactly.
Anyway, what it does to your code is non-trivial, like C# iterators. It turns your method into a "restartable method"/coroutine using a state machine it builds for you.
There is no non-trivial equivalent to this feature you can roll by hand. That's why I'd consider it so primary to the language at this point. Try to imagine c# without yield these days.
It makes it somewhat different than the other operators listed, where they are simply syntactic sugar.
I'm not sure it matters for the purpose of the quiz but one of these things is not like the others.
Real programmers use butterflies
|
|
|
|
|
Adding an equal after the coalesce, to me is just plain bad idea.
Makes the code confusing, with confusing behavior. It's just bad code to write that can be made crystal clear with an additional line of code.
It seems that they are making C# a minifier tool.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
where we have the ? for non-null access and ! for enforced non-null and some other stuff, which looks weired but helps write less code .
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I don't like these operators. They make the code harder to read.
|
|
|
|
|
Absolutly, you must read slower and more careful but you need to write and read a fair amount less code.
Finally is Swift without the ";". I missed it for a while but now I can live without it.
example:
if( p != null ) {
p->doStuff();
}
Swift:
p?.doStuff()
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Well, to be fair:
if (p) p->doStuff();
will do the job just fine.
|
|
|
|
|
Event that is a bunch longer that the Swift code.
And we often write code similar to:
obj?.devices?.first?.name
But it doesnt match our code rules:
- one single statement in line
- brace around if
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: Finally is Swift without the ";". I missed it for a while
By any chance you still miss ';', you always have C# to fall back
C#:
p?.doStuff();
|
|
|
|
|
It's been always a trade-off. Many times just because a single line was too complicated I Broke it into several lines or even made a new simple local function, at the same time trying to avoid verbosity and yes it's hard to maintain a good balance. we tend to read code more than writing or changing it. some say 5 to 1 or 10 to 1. don't matter, the point is does a programmer compress the data he needs to use a lot(to save memory) and put the burden of decompressing on CPU any times he needs it or just let it be in a plain format to have faster access?
|
|
|
|
|
it is more 10 to 1, because code is often reused or used as boiler plate.
But I also enjoy reading less code.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Because I use C++, not C#.
Looking at C# as a somewhat uninformed observer, it and .NET are bloatware. But that's somewhat unfair, because they also seem to provide application developers with more infrastructure than does C++. It's both a curse and a blessing that C# doesn't have to go through a pedantic standards group, the way that C++ does.
|
|
|
|
|
By far the most useful of the lot for me. Await is needed only based on specific flows but null handling has become really readable and easy!
|
|
|
|
|
... new language features is that they are not usable in existing bread and butter or brown field projects, and can only be used in new green field projects.
Mostly because of the amount of rework and retesting required or simply the deployment environment does not allow it.
Exception up = new Exception("Something is really wrong.");
throw up;
|
|
|
|
|
Mehdi Gholam wrote: rework and retesting required Don't replace old code, just start using it for any new code.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
True, but you are left with an inconsistent code base, which in itself is another problem.
Exception up = new Exception("Something is really wrong.");
throw up;
|
|
|
|
|
Mehdi Gholam wrote: inconsistent code base I don't see it that way.
If I had code that used all if/else statements and then decided at some point I'd start using switch statements, there's no problem have some if/else and some switchs.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I know what you mean. My company still has some code lying around that's compiled against .NET 2.0 because it has to run on really old machines. The business doesn't want to pay for any upgrades.
|
|
|
|
|
You can at least use .net4 on WinXP, .net v2 is really old, if you can upgrade the performance of the CLR alone is worth it, without any new features.
Exception up = new Exception("Something is really wrong.");
throw up;
|
|
|
|
|
Agreed. Half of the options were irrelevant to me because I'm on .net 4.x/ASP.net; and a customer that is never willing to go a few weeks without needing new features immediately makes starting an open ended task to upgrade the site to core infeasible.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
It's been 8 years since I wrote any C# code. No idea what these operators are
|
|
|
|
|
I know exactly what you mean...
For some it may look like a step backwards, but I moved from C# almost exlusively to Java.
Sometimes I have to touch old C# code but I try to avoid it as much as I can.
At some point in the last three years I lost interest in all-dot-net.
Getting used to gradle and intelliJ/Android Studio shows pretty good, how far ahead those environments are (at least for me it feels way more powerful and more responsive).
As long as I am not forced to do windows desktop development, I don't see me writing much C# code in the future.
|
|
|
|
|
I never have because of a complete lack of interest. Every time I see new "features" like these listed my point of view is affirmed.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
What's wrong with new features? I spend most of my time writing Python and .NET Core, when I write java code it feels outdated, it's like going back in time...
|
|
|
|