ReSharper, Day 2

Today, R# is kicking my butt about things I thought I was already doing.  I lobby for always checking method parameters for null before trusting any of their properties, but apparently I don’t follow my own advice well enough.  R# has found a metric buttload of places where I’m just assuming the object coming in is valid, and adding the null checks for me.  Getting that little green square in the corner is becoming a goal in itself.  That’s a good thing, as long as it doesn’t become TOO distracting.

I’ll tell you one default that I’ve just HAD to change, though.  I told R# to stop suggesting that I use implicit variable declarations.  Maybe it’s just a personal style thing, but I’d rather see the type of a variable explicitly stated wherever possible.  Usually I have no plans to change these sorts of things, and probably want to be sure that if I did, I’d have to visit each usage so that I can make sure everything still works as designed.  There have been a couple places where I thought using "var" might be very helpful though.  One of these is in code snippets or templates.  Using the var keyword, I’ve found a couple places where boilerplate code can be copied from one class to another without having to proofread it to make sure I changed all the declaration types.  I’m still undecided whether I really want to make that leap or not, though.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s