Shorter forms of {}-using statements #2938
Replies: 4 comments
-
WTF !! Man, seriously =)))))))) It seems very similar with some Kotlin feature ... context (File.OpenRead(filePath))
{
return ReadByte();
} where context is a new keyword ;) This code will transformed into: {
var myStream = File.OpenRead(filePath);
return myStream .ReadByte();
} |
Beta Was this translation helpful? Give feedback.
-
A |
Beta Was this translation helpful? Give feedback.
-
@HaloFour Yeah, it is very good !! ;) |
Beta Was this translation helpful? Give feedback.
-
using (File.OpenRead(filePath)) {
...
} This is already valid C# code and it does not mean what you want it to mean. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would find it helpful if variable declarations could be skipped in pre-8.0
using
declarations with the (inferred) variable still accessible through a leading dot.Current syntax:
Suggested new syntax:
(Suggestion of single line statements removed again, not practical)
(see also discussion of #2894)
Beta Was this translation helpful? Give feedback.
All reactions