roslynator
roslynator copied to clipboard
Feature Request: adding checked() to an integral-type cast
trafficstars
When "Quick Actions" is invoked with the cursor on an integral-type cast, like
(uint)value
It would be nice to suggest adding a checked() around the cast-expression
checked((uint)value)
But only if the cast is not already enclosed in a checked(), possibly in the larger full expression. For example, it should not be suggested for checked(3 + (uint)value)
Hmm I think this should be offered as a refactoring rather than an analyzer/codefix. You don't want a warning listed for every integral-type cast in the code.
You're right.