Update target-typed-new.md

This commit is contained in:
Julien Couvreur 2020-03-25 07:13:54 -07:00 committed by GitHub
parent 1f45494dec
commit 7ea0b8e328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,6 +76,8 @@ Action a = new(); // no constructor found
### Miscellaneous
`throw new()` is allowed.
Target-typed `new` is not allowed with binary operators.
It is disallowed when there is no type to target: unary operators, collection of a `foreach`, in a `using`, in a deconstruction, in an `await` expression, as an anonymous type property (`new { Prop = new() }`), in a `lock` statement, in a `sizeof`, in a `fixed` statement, in a member access (`new().field`), in a dynamically dispatched operation (`someDynamic.Method(new())`), in a LINQ query, as the operand of the `is` operator, as the left operand of the `??` operator, ...