3 ms·
I know this might come across as an infomercial. I'm really just a fanboy of JetBrains. To give even more context, I'm also a one handed typist (not by choice).
by scarface74 9y ago
I know this might come across as an infomercial. I'm really just a fanboy of JetBrains. To give even more context, I'm also a one handed typist (not by choice). So the various R# shortcuts really help me code faster.
Some of my most used patterns
1. Create a class
2. Type ctor + tab - create a constructor (VS)
3. Type a parameter type and a variable (R# auto completes with a reasonable name)
4. Type Alt+Enter+Enter. R# creates a private class field and assigns the parameter to the private field
----
I need to create an equality operator for a class. This is the standard c# pattern:
https://msdn.microsoft.com/ru-ru/library/ms173147(v=vs.80).aspx https://msdn.microsoft.com/ru-ru/library/ms173147(v=vs.80).a...
It's tedious. R# does this with one shortcut -> Generate Code -> generate equality comparer and then it gives you a choice of which properties should be part of the equality comparison
---
You need to quickly create an override of .ToString() maybe you just want something friendly during debugging. Say you have 10 properties. Again, that's Generate Code -> create formatting member.
----
Say your class has gotten to big and you see some methods that should be their own class.
Refactor -> Extract class.
And it will automatically create a reference to the extracted class
----
Say you have a base class and your inherited class has some members that should be in the base class or the interface.
Refactor-> Move members up
----
You have a method that has too many members and you want to create an object that encapsulates your parameter list into an object. R# can do that for you and change all of your usages throughout your code base to use your new class.
---
What if you decide to "prefer aggregation over inheritance" or you have a sealed class that can be inherited and you want to make it inheritable by doing a wrapper class.
Generate Code -> Create delegating members.
----
Say you wrote a foreach loop and realized you needed a for loop:
Alt-enter convert foreach to for
---
Say you wrote some Linq code that would be clearer imperative -> there is a shortcut for that too.
---
What if you really hate Microsoft's test runner and prefer Nunit -R# has got you covered.
----
This list doesn't include all of the other random niceties:
-Fixing namespacing throughout your project with one click
-suggesting coding standards
-Ctrl-T for universal search
-convert code to Linq expression
-safe parameter removal
-navigation shortcuts
-warns of unused classes and is smart enough to know if you're using a class via convention based Dependency Injection (i.e. automatically use Foo when a constructor asks for IFoo)
-Asp.net MVC has a lot of "stringly typed" conventions for specifying controllers and actions that will only give you runtime errors not compiled time errors R# is smart enough to know when you are using an invalid Controller/Action combination.
-extract method, extract class, extract variable and the inline reverse of all of the above.