Skip to content

Cast with default and nullable incorrectly flagged as redundant #29726

@jaredpar

Description

@jaredpar

Consider the following code:

int x = (int?)(int)default ?? 42;

The IDE suggests that the (int) cast is redundant here. Removing that though changes it from a nullable int with a value of 0 to a nullable int without a value.

Metadata

Metadata

Labels

Area-IDEBugIDE-CodeStyleBuilt-in analyzers, fixes, and refactoringsResolution-FixedThe bug has been fixed and/or the requested behavior has been implemented

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions