当我在预览时,我有时希望将其推广到文档.它是通过鼠标悬停在图标上完成的,如下所示.
有时(事实上大部分时间),我的鼠标累了,并希望我使用我的键盘进行此类促销记录.根据网上的智慧,它是通过实现的CtrlAltHome.
在我的VS中,没有任何内容分配到组合键,所以我猜测有人吃零食并在未经我许可的情况下改变了.但是,要恢复它,我需要知道Tools |中的命令 选项| 环境|键盘被调用.
我在那里找不到合适的东西(我已经尝试了MS对命令描述的不同变体:" 将Peek Definition窗口提升为常规文档选项卡 ").
那么,它叫什么?如果版本不同,我想知道每个版本的名称,其中偷看是可用的(在VS13中开始,如果我没有记错的话).
鉴于我为构图创作所做的有意义的努力,每一个人都可以清楚地看到,鉴于环境,这是一个至关重要的事情.
我正在尝试使用Immediate WindowVisual Studio 2017将值写入文件。
我有一个名为 的变量_myItems,其类型为Dictionary<int, Dictionary<int, List<int>>>。
我确实遇到了breakpoint这个变量在范围内的地方。我可以跑
?_myItems
Run Code Online (Sandbox Code Playgroud)
在窗口中,我会得到一个列表,如:
Count = 9
[0]: {[536], System.Collections.Generic.Dictionary`2[System.Int32,System.Collections.Generic.List`1[System.Int32]]]}
[1]... omitted for clearance
... omitted for clearance
... omitted for clearance
[8]... omitted for clearance
Run Code Online (Sandbox Code Playgroud)
为了确保我可以在即时窗口中写入文件,我运行了:
File.WriteAllText("test.txt", "testing purposes");
Run Code Online (Sandbox Code Playgroud)
哪个确实写入了文件,因此我确定我可以从那里写入文件。
然后我尝试了以下方法:
?(foreach (KeyValuePair<int, Dictionary<int, List<int>>> pair in _myItems) { foreach (KeyValuePair<int, List<int>> valuePair in pair.Value) { foreach (int numberToWrite in valuePair.Value) { File.AppendAllText("test.txt",numberToWrite.ToString()); } }})
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
错误 CS1525:无效的表达式术语“foreach”
通过四处搜索,我遇到了这个问题,但接受的答案仅表明您可以做到。
如何foreach在立即窗口中运行此循环以将值写入文件。 …
当应用程序未运行时,可以在Visual Studio中从即时窗口执行静态方法.
特定
namespace Handyman
{
public class Program
{
static void Main(string[] args)
{
}
static string SayHello(string name)
{
return string.Format("Hello {0}!", name);
}
}
}
Run Code Online (Sandbox Code Playgroud)
SayHello静态方法可以使用即时窗口执行
?SayHello("Miki Kola")
Run Code Online (Sandbox Code Playgroud)
语法并将消息返回到即时窗口.
我想知道是否可以使用相同的技术在对象上执行方法?当然,您必须首先创建对象.
特定
namespace Handyman
{
public class NiceTooMeetYou
{
public string NiceToMeetYou(string name)
{
return string.Format("It is nice to meet you {0}!.", name);
}
}
}
Run Code Online (Sandbox Code Playgroud)
当命令
?(new Handyman.NiceToMeetYou().NiceToMeetYou("Miki Kola"))
Run Code Online (Sandbox Code Playgroud)
在即时窗口中执行
The type or namespace name 'NiceToMeetYou' does not exist in the namespace 'Handyman'
Run Code Online (Sandbox Code Playgroud)
出现错误消息.我错过了语法或概念吗?:)