Support target-type new expressions.
See original GitHub issueRight now this fails to parse:
internal static class EnumFormatters
{
public static readonly EnumFormatter<AnalysisKind> AnalysisKind = new(value => (int)value, value => (AnalysisKind)value);
}
failing at the = new(
bit. I think this is the relevant piece of syntax.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Target-typed new expressions - C# 9.0 draft specifications
This feature specification describes the enhancements to 'new' where the target type can be inferred from the variable declaration.
Read more >C# 9.0: Target-typed New Expressions – Make Your ...
Target-typed means that an expression gets the type from the context it is used in. With C# 9.0 the new expression gets the...
Read more >Target-typed new() expressions in C# 9 - Vahid Farahmandian
We all know that when we want to create a new object we need to use 'new' keyword plus specifying the target type...
Read more >Target-typed new Expressions In C# 9.0 You Should Know...
Want to Learn about C# 9.0 Target-typed new Expressions ? Today I am sharing exactly what Target-typed new Expressions In C# 9.0 are...
Read more >Generalized Target-Type Inference in Java - Baeldung
The Target-Type of an expression is the data type that the Java Compiler expects depending on where the expression appears. Java 8 supports...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The new without a type is a new C# 9 feature called target-type new expressions. This is the issue for it: https://github.com/dotnet/csharplang/issues/100
So it is simply a new feature, not really a bug in the current syntax.
I think this issue can be closed now.