Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now
Showing posts with label Oops Tutorials in C#. Show all posts
Showing posts with label Oops Tutorials in C#. Show all posts

Most Popular Visual Studio Shortcut Keys

If a developer saves a small fraction of time in each of these activities, then it can improve productivity significantly. Using shortcut keys and commands can help to save time and result in considerable improvement as well as productivity.

In this article, I will share the most useful and trendy shortcut keys for visual studio which apply globally if it is not specified or altered. These shortcut keys are available for general or every profile for visual studio installed.

We can categorize these shortcut keys based on activities like to build, debug, Code Editor, File, Project, refactor, tools, and so on.

Build: popular shortcuts

BUILD: POPULAR SHORTCUTS

Commands

Keyboard shortcuts

Command ID

Build solution

Ctrl+Shift+B

Build.BuildSolution

Cancel

Ctrl+Break

Build.Cancel

Compile

Ctrl+F7

Build.Compile

Run code analysis on solution

Alt+F11

Build.RunCodeAnalysisonSolution

 

Debug: popular shortcuts

DEBUG: POPULAR SHORTCUTS

Commands

Keyboard shortcuts [Special contexts]

Command ID

Break at function

Ctrl+B

Debug.BreakatFunction

Break all

Ctrl+Alt+Break

Debug.BreakAll

Delete all breakpoints

Ctrl+Shift+F9

Debug.DeleteAllBreakpoints

Exceptions

Ctrl+Alt+E

Debug.Exceptions

Quick watch

Ctrl+Alt+Q

or Shift+F9

Debug.QuickWatch

Restart

Ctrl+Shift+F5

Debug.Restart

Run to cursor

Ctrl+F10

Debug.RunToCursor

Set next statement

Ctrl+Shift+F10

Debug.SetNextStatement

Start

F5

Debug.Start

Start without debugging

Ctrl+F5

Debug.StartWithoutDebugging

Step into

F11

Debug.StepInto

Step out

Shift+F11

Debug.StepOut

Step over

F10

Debug.StepOver

Stop debugging

Shift+F5

Debug.StopDebugging

Toggle breakpoint

F9

Debug.ToggleBreakpoint

 

 

Edit: popular shortcuts


EDIT: POPULAR SHORTCUTS

Commands

Keyboard shortcuts [Special contexts]

Command ID

Break line

Enter [Text Editor, Report Designer, Windows Forms Designer]

or Shift+Enter [Text Editor]

Edit.BreakLine

Collapse to definitions

Ctrl+MCtrl+O [Text Editor]

Edit.CollapseToDefinitions

Comment selection

Ctrl+KCtrl+C [Text Editor]

Edit.CommentSelection

Complete word

Alt+Right Arrow [Text Editor, Workflow Designer]

or Ctrl+Spacebar [Text Editor, Workflow Designer]

or Ctrl+KW [Workflow Designer]

or Ctrl+K, Ctrl+W [Workflow Designer]

Edit.CompleteWord

Copy

Ctrl+C

or Ctrl+Insert

Edit.Copy

Cut

Ctrl+X

or Shift+Delete

Edit.Cut

Delete

Delete [Team Explorer]

or Shift+Delete [Sequence Diagram, UML Activity Diagram, Layer Diagram]

or Ctrl+Delete [Class Diagram]

Edit.Delete

Find

Ctrl+F

Edit.Find

Find all references

Shift+F12

Edit.FindAllReferences

Find in files

Ctrl+Shift+F

Edit.FindinFiles

Find next

F3

Edit.FindNext

Find next selected

Ctrl+F3

Edit.FindNextSelected

Format document

Ctrl+K, Ctrl+D [Text Editor]

Edit.FormatDocument

Format selection

Ctrl+K, Ctrl+F [Text Editor]

Edit.FormatSelection

Go to

Ctrl+G

Edit.GoTo

Go to declaration

Ctrl+F12

Edit.GoToDeclaration

Go to definition

F12

Edit.GoToDefinition

Go to find combo

Ctrl+D

Edit.GoToFindCombo

Go to next location

F8

Edit.GoToNextLocation

Insert snippet

Ctrl+KCtrl+X

Edit.InsertSnippet

Insert tab

Tab [Report Designer, Windows Forms Designer, Text Editor]

Edit.InsertTab

Line cut

Ctrl+L [Text Editor]

Edit.LineCut

Line down extend column

Shift+Alt+Down Arrow [Text Editor]

Edit.LineDownExtendColumn

Line open above

Ctrl+Enter [Text Editor]

Edit.LineOpenAbove

List members

Ctrl+J [Text Editor, Workflow Designer]

or Ctrl+K, Ctrl+L [Workflow Designer]

or Ctrl+K, L [Workflow Designer]

Edit.ListMembers

Navigate to

Ctrl+,

Edit.NavigateTo

Open file

Ctrl+Shift+G

Edit.OpenFile

Overtype mode

Insert [Text Editor]

Edit.OvertypeMode

Parameter info

Ctrl+Shift+Spacebar [Text Editor, Workflow Designer]

or Ctrl+K, Ctrl+P [Workflow Designer]

or Ctrl+K, P [Workflow Designer]

Edit.ParameterInfo

Paste

Ctrl+V

or Shift+Insert

Edit.Paste

Peek definition

Alt+F12 [Text Editor]

Edit.PeekDefinition

Redo

Ctrl+Y

or Shift+Alt+Backspace

or Ctrl+Shift+Z

Edit.Redo

Replace

Ctrl+H

Edit.Replace

Select all

Ctrl+A

Edit.SelectAll

Select current word

Ctrl+W [Text Editor]

Edit.SelectCurrentWord

Selection cancel

Esc [Text Editor, Report Designer, Settings Designer, Windows Forms Designer, Managed Resources Editor]

Edit.SelectionCancel

Surround with

Ctrl+K, Ctrl+S
(available only in Visual Studio 2019 and earlier)

Edit.SurroundWith

Tab left

Shift+Tab [Text Editor, Report Designer, Windows Forms Editor]

Edit.TabLeft

Toggle all outlining

Ctrl+M, Ctrl+L [Text Editor]

Edit.ToggleAllOutlining

Toggle bookmark

Ctrl+K, Ctrl+K [Text Editor]

Edit.ToggleBookmark

Toggle completion mode

Ctrl+Alt+Space [Text Editor]

Edit.ToggleCompletionMode

Toggle outlining expansion

Ctrl+M, Ctrl+M [Text Editor]

Edit.ToggleOutliningExpansion

Uncomment selection

Ctrl+K, Ctrl+U [Text Editor]

Edit.UncommentSelection

Undo

Ctrl+Z

or Alt+Backspace

Edit.Undo

Word delete to end

Ctrl+Delete [Text Editor]

Edit.WordDeleteToEnd

Word delete to start

Ctrl+Backspace [Text Editor]

Edit.WordDeleteToStart

 


File: popular shortcuts

FILE: POPULAR SHORTCUTS

Commands

Keyboard shortcuts [Special contexts]

Command ID

Exit

Alt+F4

File.Exit

New file

Ctrl+N

File.NewFile

New project

Ctrl+Shift+N

File.NewProject

New web site

Shift+Alt+N

File.NewWebSite

Open file

Ctrl+O

File.OpenFile

Open project

Ctrl+Shift+O

File.OpenProject

Open web site

Shift+Alt+O

File.OpenWebSite

Rename

F2 [Team Explorer]

File.Rename

Save all

Ctrl+Shift+S

File.SaveAll

Save selected items

Ctrl+S

File.SaveSelectedItems

View in browser

Ctrl+Shift+W

File.ViewinBrowser

Project: popular shortcuts

PROJECT: POPULAR SHORTCUTS

Commands

Keyboard shortcuts [Special contexts]

Command ID

Add existing item

Shift+Alt+A

Project.AddExistingItem

Add new item

Ctrl+Shift+A

Project.AddNewItem

Refactor: popular shortcuts

REFACTOR: POPULAR SHORTCUTS

Command

Keyboard shortcut [Special contexts]

Command ID

Extract method

Ctrl+R, Ctrl+M

Refactor.ExtractMethod

Tools: popular shortcuts

TOOLS: POPULAR SHORTCUTS

Command

Keyboard shortcut [Special contexts]

Command ID

Attach to process

Ctrl+Alt+P

Tools.AttachtoProcess

View: popular shortcuts

VIEW: POPULAR SHORTCUTS

Commands

Keyboard shortcuts [Special contexts]

Command ID

Class view

Ctrl+Shift+C

View.ClassView

Edit label

F2

View.EditLabel

Error list

Ctrl+\, Ctrl+E

or Ctrl+\, E

View.ErrorList

Navigate backward

Ctrl+-

View.NavigateBackward

Navigate forward

Ctrl+Shift+-

View.NavigateForward

Object browser

Ctrl+Alt+J

View.ObjectBrowser

Output

Ctrl+Alt+O

View.Output

Properties window

F4

View.PropertiesWindow

Refresh

F5 [Team Explorer]

View.Refresh

Server explorer

Ctrl+Alt+S

View.ServerExplorer

Show smart tag

Ctrl+.

or Shift+Alt+F10 [HTML Editor Design View]

View.ShowSmartTag

Solution explorer

Ctrl+Alt+L

View.SolutionExplorer

TFS Team explorer

Ctrl+\, Ctrl+M

View.TfsTeamExplorer

Toolbox

Ctrl+Alt+X

View.Toolbox

View code

Enter [Class Diagram]

or F7 [Settings Designer]

View.ViewCode

View designer

Shift+F7 [HTML Editor Source View

View.ViewDesigner

 




Visual Studio Shortcuts for Developers

  1. While code review I found scattered and unaligned code many time which we all hate. I used CTRL+K+D for aligning it. The left side of my code is scattered, so first I selected the area of code and then applied CTRL+K+D.




  2. Use F12 to go to definition of class. Use CTRL- to go back.
  3. Resolve the classes and use CTRL+.
  4. Refactoring is very important. Use CTRL+R+M for extracting a method.
  5. Want to put few lines of code in try block. Try Ctrl + K + S.




    It provides a lot of options.

  6. Ever tried selecting a rectangle code. Use ALT click drag.
  7. Lots of code in a single file. Use CTRL + M + O and CTRL + M + X in collapse/expand code groups like regions, methods.
  8. Lots of code and there are no groups. Use CTRL+M+H/CTRL+M+U.
  9. Create new Class using CLS and press TAB twice, or
  10. Create constructor using CTOR and press TAB twice.
  11. Create properties using PROP and press TAB twice.



  12. Create for loop using CTRL+K+S, then go to foreach and press Enter or TAB.




  13. Write full property definition that we used in earlier to C# 3.0, then use propfull, press TAB twice.




  14. Create switch block, use switch, press TAB twice



  15. Write our own custom exception class that should inherit from Exception class.

    Exception press TAB twice.

  16. Write console.writeline, use cw, press TAB twice.
  17. Show the horizantal space by dot  use  CTRL+R, CTRL+W
  18.  Remove the Horizontal space , CTRL+ K  ,CTRL+ \
  19.  Shifting the code  left side  use Shift +Tab
  20. Shifting  code right side use  , select the code and use Tab

Another Visual Studio Shortcuts for Developers

  1. For creating an MVC [HttpGet] action method use mvc4 and press TAB twice.




  2. For creating MVC [HttpPost] action method, use mvcp and press TAB twice.




  3. For creating unit test class in MVC application, use test and press TAB twice.




  4. For creating Unit test method, use testm and press TAB twice.




  5. For creating a region, use reg and press TAB twice.




  6. For creating static int Main (string[] args), use sim and press TAB twice.







  7. Create auto implemented properties with 'get' accessor and private 'set' accessor using propg and press TAB twice.




  8. For creating void main method use svm and press TAB twice.




  9. Create try finally block using tryf and press TAB twice.

  10. Create MessageBox.show(“”) using mbox  andpress TAB twice.

  11. Create Interface using int and press TAB twice.

  12. Create foreach() loop using fore and press TAB twice.

  13. Create do while loop using do and press TAB twice.

  14. Create for loop using for and press TAB twice.

  15. Create while loop using wh and press TAB twice.

Some other tips and tricks:

  • Open Package Manager Console using ALT + T + N and press Enter key.

  • Build the project using CTRL + SHIFT + B.

  • Open Solution Explorer using CTRL + ALT + L.

  • Open Server Explorer using CTRL + ALT + S.

  • Find the location of project, right click on project and go to open folder in file explorer, then press enter or click.




  • Start Visual Studio from “Run” command prompt using devenv, then click ok.



  • See all errors in your document, project, or solution by using  CTRL+\,E    or       Ctrl+W,E 
  • Navigate to any file/type/member/symbol declaration by using   CTRL+T

 

 Reference


Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now