Skip to content

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

Updated: at 02:12 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.

Check out the ORM (Object Relational Mapper) PRISMA. The database access method I use in all my projects