Refactoring C# Code With ReSharper Help


  A pattern that I do quite often is to first right out code that actually works, then when I see a pattern repeat itself, I like to refactor that code to try and avoid the repetitive code.  Reasons include: Smaller Code Less Chance For Error Don’t Repeat Yourself (DRY) As an example, the c# code I’m working on now involves reading key values to be used with the Stripe payment service.  Here is the code I first wrote: [crayon-5517c40628d02476267875/] The first thing I do is to look for the pattern and try and pull out variables that I know are going to be helpful in refacotring. You can see below that I pulled out the keyAppName variable and I also changed the assignment to be to a new variable rather than … Continue Reading

ReSharper Continues to Make My Life Easier as a Programmer


Again, it happened.  I was about go searching the web for the string format parameters to figure out how to format just the day of the week.  I type some code like this: [crayon-5517c40629c63368048518/] And up pops up the below screen from JetBrains Resharper giving my choices for ToString(). Very nice! Just sayin... … Continue Reading

My What’s New in ExtJS 5 Training Video Live!


My 3rd Pluralsight  Sencha training video is now live.  Basically I take you through the steps of building a straight forward conference session viewer application using most of the new features in ExtJS 5. The major new features in this upgrade from Sencha that are explained include Model-View-View-Model (MVVM) architecture, 2-way data binding, formulas, tablet support, Routing Translations, and significant new capabilities with models and stores. This is my third training video on Sencha's technology.  The first was Sencha Touch, the second ExtJS Fundamentals (which this course builds on) and of course this one on ExtJS 5.  If you have not programmed Sencha's ExtJS before, it is strongly advised that you watch the fundamentals video … Continue Reading

All ASP.NET MVC Forms Need To Include Html.AntiForgeryToken() For Security


Having recently been implementing many new form pages in ASP.NET MVC, I’ve found myself over and over again adding the following two things to every form. After Html.BeginForm() I Put @Html.AntiForgeryToken() Add the Attribute [ValidateAntiForgeryToken] To Every Post Action Method Before I was doing so much ASP.NET MVC, I would often see in Channel 9 videos, the presenter add the AntiForgeryToken() after the BeginForm() method on the cshtml razor page and say something like “you should always add this”.  I never saw them say “and don’t forget to add the attribute ValidateAntiForgeryToken to the controller POST method. Just to be clear, below is what I’m talking about: What this does is to make sure that the trusted … Continue Reading


Get every new post delivered to your Inbox

Join other followers: