[英]Shortcut to string in Visual Studio
使用Visual Studio控制台應用程序時,我經常使用以下代碼行:
Console.WriteLine("press [enter] to exit");
有沒有辦法在Visual Studio中設置快捷鍵,這樣我每次都不需要輸入它?
由於某種原因我可能會經常使用其他代碼行,因此快捷功能將是有益的。
將其保存在(文件名).snippet中
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>cwe</Title>
<Shortcut>cwe</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[Console.WriteLine("press [enter] to exit");]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
接下來選擇tools-> code snippet manager ...,單擊import,選擇你的文件並添加。
現在,如果您在編碼時鍵入cwe
,請單擊Tab。
如果您經常需要使用Console.WriteLine()
,則可以鍵入c + w + Tab
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.