Improve Redundant Cast inspection in VB
I have found following piece of code in a VB application i have to maintain:
dim monthValue as string
monthValue = CDate(dtpDateTimePicker.Value).Month.ToString("00")
The value of a DateTimepicker is already a date, so the CDate() conversion is redundant. I tried to create a custom pattern to find this kind of code, but nevertheless how i define the variables i got no or wrong results. I think it should be no problem for R# to generate a warning on this type of casts (also for the other C... like CInt(), CStr() and so on).
So i ask the Jetbrains team if they could enhance the Redundant Cast inspection to recognize this special VB cast functions.
Regards
Klaus
Please sign in to leave a comment.
Hello Klaus
Thank you for suggestion! You're welcome to vote for the following feature request: http://youtrack.jetbrains.com/issue/RSRP-309832.
Andrey Serebryansky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"