简体   繁体   English

在Visual Studio即时窗口中自动执行命令

[英]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. 每当我想知道视图的调用方控制器/操作(在调试模式下)时,我都会在Visual Studio立即窗口中使用以下两个命令。

@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. 1-如果您在“立即窗口”中使用“向上箭头”,则最后一个提示将为您显示,此时您需要按“输入”键来执行它。

2- Why not to use the 'watch' panel, it could save this for you, and it will update whenever the value has changed 2-为什么不使用“监视”面板,它可以为您保存该面板,并且只要值更改,它就会更新

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2013立即窗口和缓慢搜索 - Visual studio 2013 immediate window and searching slow 在Visual Studio立即窗口中清除堆栈 - Clear Stack in Visual Studio Immediate Window 将XmlReader XML写入Visual Studio中的即时窗口? - Write XmlReader XML to immediate window in Visual Studio? C#是否可以在Visual Studio中测试是否使用即时窗口的语句? - C# Is it possible to testing if statement using immediate window in visual studio? 在Visual Studio的即时窗口中未捕获到未处理的异常 - Unhandled Exception not being caught in Immediate Window of Visual Studio Visual Studio立即窗口“表达式计算器中的内部错误” - Visual Studio Immediate window “Internal error in the expression evaluator” Linq扩展方法在Visual Studio 2015即时窗口中不可用 - Linq Extension Methods Not available in Visual Studio 2015 Immediate Window 使用 C# 在 Visual Studio 中的即时窗口上运行多行 - Running multiple lines on the immediate window in Visual Studio with C# 如何在visual studio的即时窗口中运行foreach循环? - How can I run a foreach loop in the immediate window of visual studio? 是否可以在Visual Studio 2017的直接窗口中使用数据上下文? - Is it possible to use a Data context in the immediate window of Visual Studio 2017?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM