loudhaa.blogg.se

Resharper using inside namespace
Resharper using inside namespace







Resharper using inside namespace code#

If I select all the code inside the catch (from the new RaygunClient() call down to the last bracket of the else) then hit Ctrl + R, Ctrl + M Resharper will offer to create a method for me. The error handling is noise and looks a bit generic – I’ll put that in a separate method for now and reuse it later if I can. There are a few other things that clutter this method up a bit. At this point Resharper will also check the rest of the method to see if there are any other pieces of code that look like that, and offer to replace them as well. That Base64.DecodeID call looks like it should really be a variable called customerIdentifier to me, so I highlight Base64.DecodeID(customer.Id) and hit Ctrl + R, Ctrl + V, tell R# to call it customerIdentifier, and hit enter. ModelState.AddModelError( "", "An unknown error occurred") įirst, extract a few properly named variables by selecting some code and hitting Ctrl + R, Ctrl + V. ModelState.AddModelError( "", em.Message) Subscription.UpdateCustomerBilling(customer) įoreach( var em in exception.ErrorMessages) Subscription.UpdateCustomerName(customer) Var subscription = _subscriptionService.GetCustomer(Base64.DecodeID(customer.Id)) Public void UpdateCustomerDetails(CustomerModel customer) If I’m staring at a big method with no idea what it does, I start ripping it apart with these two tools. Resharper adds a bunch more options though, ones you’ll definitely find useful.Įxtract Variable and Extract Method are my favourites. Refactoring toolsĮveryone has seen the Rename tool before, that’s something VS has supported for ages. Find All Usages is my personal favourite – this is bound to Ctrl-Shift-F12 by default, but it’s worth chucking it on something a little less spread out as it’s pretty handy. Right click on an interface name and pick Go to Implementation to jump to all implementations of that interface (go figure).

resharper using inside namespace

If you are more inclined to use a mouse, Resharper adds a whole lot of things to the right click menu in the Text Editor.

resharper using inside namespace

Classes, properties, methods, files, the lost city of Atlantis, you name it, it goes there. Ctrl + T in Resharper 9 navigates to anything by name.







Resharper using inside namespace