Skip to content

A Quick Thank you and At-A-Program For Resharper and Refactoring

Updated: at 11:18 PM

I had the following line embedded in an initializer:

EmailAlerts = String.IsNullOrEmpty(emailAlerts) ? false : emailAlerts.ToLower().Equals("true"),

Resharper says (“Simplify conditional operator”)




I say sure, ReSharper does

EmailAlerts = !String.IsNullOrEmpty(emailAlerts) && emailAlerts.ToLower().Equals("true"),

Clean, Elegant.  I’ve had some posts like this criticized in the past with comments like “Well, if you can’t do that on your own you shouldn’t be programming”.  My reply: “I could have, I didn’t, It did, and I like it better.


That’s it for now.