Replies: 3 comments 4 replies
-
The certain library usage is confusing, yes. But that feature isn't designed with that usage in mind. There's nothing prevent tricky usages in libraries. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry that you do not appreciate the evolution of the language and find that it makes it difficult to comprehend. Unfortunately C#, as almost all programming languages, is only going to continue to evolve and to add new features. One tricky use of a feature does not make the feature bad. Without extension methods LINQ would not have happened, and LINQ is probably of the most productivity-boosting features in the C# language. |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, the specific example you provide is of two features (object and collection initializers, extension methods) that were added 14 years ago in C# 3. (https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-30) |
Beta Was this translation helpful? Give feedback.
-
First,apologize for my english.
Last several years, csharplang had added more and more feature . But as a open source program language, source code should be readily comprehensible ,or it will hamper other people effort to contribute to open source project .
For example,when I study code of dotnet/diagnostics,It took me lots of time to understand CollectCommandHandler.CollectCommand method that why the first arguments is a ICommandHandler until I find CommandExtensions.Add method.
From my personnal oponion, i do not agree with this feature . It make source code too complex to understand .
https://github.com/dotnet/diagnostics/blob/f2ee9569cfa90fa5c15fc27278785a55c555cb29/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs#L380
https://github.com/dotnet/diagnostics/blob/f2ee9569cfa90fa5c15fc27278785a55c555cb29/src/Tools/Common/CommandExtensions.cs#L15
Beta Was this translation helpful? Give feedback.
All reactions