ModelState.AddModelError( "", "An unknown error occurred") įirst, extract a few properly named variables by selecting some code and hitting Ctrl + R, Ctrl + V. 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. 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. There are a few other things that clutter this method up a bit. 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. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |