Showing posts with label Resharper. Show all posts
Showing posts with label Resharper. Show all posts

Wednesday, 15 February 2017

Resharper shorcut cheat sheet

Quite by chance today I stumbled across a new way to learn Resharper shortcuts.

In visual studio, when editing a file, tap the ctrl key three times in quick succession. This brings up the cheat sheet

clip_image002

Then hold down the Ctrl key, Shift Key, or Alt Key when the dialog is open, and you'll see what short cuts are applicable to the development pane that you're in

clip_image002[4]

Wednesday, 11 February 2015

Resharper running slowly

Just found a neat trick for speeding up the Ctrl+T navigation slowness against my solution with JetBrains Resharper 8.2

1. Clean out your cache folder for the solution...

%userprofile%\AppData\Local\JetBrains\ReSharper\v8.2\SolutionCaches

2. Resinstall Resharper

Tuesday, 12 August 2014

Resharper equivalent for clipboard ring

Assigned Ctrl+Shift+V to ReSharper.ReSharper_PasteMultiple instead as I find this to be a much more useful interface than trying to guess what the last 10 items on your clipboard are.
Plus it supports way more items than just the 10 you get with Visual Studio.
image

Friday, 28 September 2012

How to create the DataContracts and Translators for Entity Framework generated objects

Think I've just come up with a fool proof method for creating datacontracts and associated translator logic from Entity Framework generated objects

Creating datacontracts

1. Grab the class definition from the xxxModel.cs file in xxxx.DataContracts.csproj project

2. Paste into a new file in the xxx.DataContracts namespace

3. Use Resharper to clean up the code (Ctrl +E , Ctrl + C), choose full format option

4. Suspend off Resharper (Tools, options ,Resharper)

5. Grab the primitives section and change privates to publics

6. Replace ; with { get; set; } and then replace _ with empty string

7. That's it, you now have your matching datacontract with no typos and property names matching the auto generated ones in the xxxModel.cs file.

Creating translators (little bit more involved) method

1. Use the following regex replace expression on the pasted properties from the class you created above.

Remember to paste them from the datatype definition onwards, and put them at the start of the line in the mapping class first! e.g.

String Author { get; set; }
String DMlibraryName { get; set; }
DateTime? DateCreated { get; set; }
String DocNAME { get; set; }
int? DocNumber { get; set; }
String DocPath { get; set; }
String DocTypeCode { get; set; }
String DocTypeDescription { get; set; }
Int32 IsDMType { get; set; }
Int32 IsRRAKMANType { get; set; }
int? PersonID { get; set; }
int? ProjectID { get; set; }
String ProjectLabel { get; set; }
String htmlLocation { get; set; }

Find: ^([a-zA-Z_$][a-zA-Z0-9_$?]*):b{(.*)}\{(.*)
Replace with: source.\1 = dest.\1;

Result is as follows...

source.Author  = document.Author;
source.DMlibraryName  = document.DMlibraryName;
source.DateCreated  = document.DateCreated;
source.DocNAME  = document.DocNAME;
source.DocNumber  = document.DocNumber;
source.DocPath  = document.DocPath;
source.DocTypeCode  = document.DocTypeCode;
source.DocTypeDescription  = document.DocTypeDescription;
source.IsDMType  = document.IsDMType;
source.IsRRAKMANType  = document.IsRRAKMANType;
source.PersonID  = document.PersonID;
source.ProjectID  = document.ProjectID;
source.ProjectLabel  = document.ProjectLabel;
source.htmlLocation  = document.htmlLocation;

(Old Creating translators (little bit more involved) method)

1. Turn resharper back on

2. Use the File Structure window

clip_image001

3. Stick this in Excel and do some manipulation (ask me if you're not sure how to do this)

clip_image002

4. Paste this back into your C# file, and do a regex replace of \t with nothing

5. That's it, translator code written

Friday, 11 May 2012

Alternatives to .NET Reflector

ILSpy = http://wiki.sharpdevelop.net/ILSpy.ashx

Decompilation to C#

  • Supports lambdas and 'yield return'
  • Shows XML documentation

 

JetBrains dotPeek = http://www.jetbrains.com/decompiler/

Uses similar keyboard shortcuts to JetBrains Resharper.

Saturday, 17 March 2012

Navigating code without Resharper

 

Use Ctrl+K, Ctrl+V for class view search, then type the member name you want to go to...

image

Although on large solutions it's not quite as blistering fast as Resharper navigation

You can also invoke static methods from here to test them, without having to spin up MSTest or the like...

image

Thursday, 15 March 2012

Resharper TODO Explorer Custom Tags

 

Today I stumbled across a very neat little feature in Resharper that can help immensely when carrying out large code refactoring on a solution as we're doing now currently in our code base. (http://www.jetbrains.com/resharper/webhelp/Configuring_ReSharper__Sharing_Configuration_Options.html )

Turns out you can set up custom tags for the TODO item explorer, and use these to jump quickly through the code base to locations that you need to come back to at a later date (using Ctrl+Alt+PgDown when the TODO item explorer is the active window)

We've created a custom tag of DBR to easily search for code areas relating to database refactor tasks that need doing still. ..

clip_image001

This then automatically gets added to anyone working on our branch via saving off the custom tag into the team MySolution.sln.DotSettings file, which is then added to source control as a Solution Item…

clip_image002

Then, with the TODO item explorer (Ctrl+Alt+D) you can filter for these tags only in code as follows…

clip_image003

If you have any custom tags you wish to add to the team shared folder then you'll need to copy them to the team shared file (ensure you have it checked out first), via the Resharper, Manage Options, menu option as follows…

clip_image004 clip_image005

You can type whilst the TODO explorer window is activated, and it will filter to those items that have the search phrase you typed in…

image

More information here about all of this...

http://www.jetbrains.com/resharper/webhelp/Configuring_ReSharper__Sharing_Configuration_Options.html

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...