Friday, December 16, 2016

Shallow Copy an array in JavaScript

Who knew?
var copyOfArray = originalArray.slice();
Apparently Array.slice, if called with no parameters, returns a copy of the entire array. Kinda cool!

Wednesday, December 07, 2016

Formatting in ReSharper vs. formatting in Visual Studio

Interesting. Ctrl-K Ctrl-D reformats a file using Visual Studio rules, while Ctrl-Alt-Enter reformats a file using ReSharper rules.

Here's an example, using Visual Studio formatting (Ctrl-K Ctrl-D):
            var patient = new Patient { AccountNumber = accountNumber };
And the same code using ReSharper formatting (Ctrl-K Ctrl-F):
            var patient = new Patient {AccountNumber = accountNumber};
I would have thought that ReSharper would take over the Ctrl-K Ctrl-D and Ctrl-K Ctrl-F keyboard shortcuts, but it does not.