[OT] Sharp Regrets: Top 10 Worst C# Features

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 19 02:17:56 PDT 2015


On Wednesday, 19 August 2015 at 01:12:36 UTC, Adam D. Ruppe wrote:
> I just saw this link come by my desktop and I thought it was an 
> interesting read because D does a lot of these things too, and 
> avoids some of them:
>
> http://www.informit.com/articles/article.aspx?p=2425867
>
> I don't agree they are all mistakes, but it is a pretty quick 
> and interesting read.

10. Huh, never seen bugs caused by syntax. Maybe our codemonkeys 
are not braindead enough? But if you want to solve this for good, 
no empty statement is good, use nop() function instead.
7. Delegate syntax allows to skip arguments declarations, quite 
handy when you don't need them.
6. Heh, didn't know about HasFlag.
5. If this was true, .net programmers would use vb.net and C 
programmers would use pascal.
2. Yes, this proves to be hard for C++ programmers to grok.

for loop is useful when you want to start from arbitrary index.

 From comments:
>Events are null, but you can add a subscriber to them. And you 
>can't trigger a null one. Which leads to the same convoluted 
>code around event trigger.
>Similarly, there's no reason why "foreach" couldn't treat a null 
>list as an empty one - saving me from having to worry about 
>which methods return nulls list objects and which ones return 
>empty ones...

Yep, nulls should be equivalent to empty collections.


More information about the Digitalmars-d mailing list