Replies: 1 comment
-
|
Duplicate of dotnet/csharplang#9951, but posted by a different person in the wrong repo. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Ideas to Improve the C# Syntax
Primary Constructors with Auto Properties
should be equivalent of
The optional
readonlymodifier can introduce property with the getter only.Benefits
Custom DSL syntax support
When a delegate (Action<> or Funct<>) is the last parameter of a method, the call can be simplified to move the delegate out of brackets. If the delegate is the only parameter, then even omit the brackets entirely.
A method:
Usage:
Without it:
And in addition if there is
thismodifier, it allows to write inline extensions:And now the usage:
Benefits
usingwith very similar syntax;can be omitted to have experience likeusingitfor the first lambda parameter, it shortens the syntax tooShorthand Properties
This
is adequate to the
Benefits
class Foo(val Int Count)Constants and Static Methods Can be Without Class
is equivalent to the
usage:
or
Benefits
Beta Was this translation helpful? Give feedback.
All reactions