每当我在 VS 2008 (C#) 中创建方法签名时,我都会键入两个大括号:
public void Something() {}
这会将光标留在右大括号的右侧。然后我必须使用箭头键将光标重新定位在大括号之间。有没有更好的方法可以不使用箭头键来执行此操作?
我希望它在我输入右大括号时将光标放在大括号之间,这样我就可以开始输入代码了。
最佳答案
我目前没有 vs2008。假设 VS2008 仍然支持这个,你可以使用代码片段。弄乱下面直到你得到你需要的东西。 (参见工具|代码片段管理器)
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>b</Title>
<Shortcut>b</Shortcut>
<Description>Braces with cursor inside</Description>
<Author>CrashCodes</Author>
</Header>
<Snippet>
<Code Language="csharp"><![CDATA[{
$end$
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
关于c# - 在 C# 中键入右大括号后,如何自动将光标定位在方法大括号之间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/310247/