VS Messages - IDE0090 - 'new' expression can be simplified
Rule ID | IDE0090 |
---|---|
Title | Simplify new expression |
Applicable languages | C# 9.0+ |
This style rule concerns the use of C# 9.0 target-typed new expressions when the created type is apparent.
Example:
Visual Studio Intellisense shows "new" expression can be a simplified message.
I have this code:
MyClass myClass= new MyClass();
VS Intellisense shows:
'new' expression can be simplified
Solution: Change the code to:
MyClass instance = new();
No comments:
Post a Comment