简体   繁体   中英

Automate a command in Visual Studio Immediate Window

Whenever I want to know the caller controller/action of a View (in debug mode), I use two following commands in Visual Studio Immediate Window.

@ViewContext.Controller.ValueProvider.GetValue("controller").RawValue 
@ViewContext.Controller.ValueProvider.GetValue("action").RawValue

Is there any way to automate this process instead of typing them in Immediate Window all the time? or any better way to find out the Caller?

Update:

By automating I mean adding a shortcut key to execute this command or adding a Menu Item to the Context Menu.

I know that there is no need to type and I can hit up arrow key. However, I need a more robust method.

1- if you use the 'up arrow' inside the 'Immediate Window' then the last instrcution will appear for you, you just then need to press the 'enter' key to execute it.

2- Why not to use the 'watch' panel, it could save this for you, and it will update whenever the value has changed

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM