Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Love C# but

  public static implicit operator ClassA(ClassB b)
Is very verbose. There are probably worse offenders. C# devs also love to add access modifiers even when its not needed. For example, private for anything that is meant to be private or the suffix `Async` even though you don't have a sync version of a method.


The private keyword is needed because the default access is public to the same assembly. Usually that's very different from private.

As for the implicit cast, two extra tokens in an uncommon case doesn't seem so bad when you consider all the nice common things like var, the lambda syntax, initializers, pattern matching, LINQ, delegates, etc. etc.


Default visibility for type members is private, default visibility for not-nested types is internal.

Defining implicit cast operators frequently (especially ClassA -> ClassB) might be a sign that a better implementation is required. In practice, it's not done often.

Agree on unncessary Async suffix. It is a common mistake (it is one) to add it for methods that cannot or will not offer non-async variants.


In a sense, internal is just another way of viewing it as “private to the assembly”. If i don’t need something to be reached by another assembly, then typing `internal` when not necessary is just too much.

Note: I’m ignoring <InternalsVisibleTo> csproj property.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: