1. Save the following code as .snippet file by text editor.
將以下程式碼,以文字編輯器存為 .snippet 檔案
3. [Import] > select the .snippet file > [Finish] > [OK]
4. Type "cr" and [TAB] twice as Console.Readline hotkey
credit: Johan
將以下程式碼,以文字編輯器存為 .snippet 檔案
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>cr</Title>
<Shortcut>cr</Shortcut>
<Description>Code snippet for Console.ReadLine</Description>
<Author>Whoever you want it to be</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal Editable="false">
<ID>SystemConsole</ID>
<Function>SimpleTypeName(global::System.Console)</Function>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[$SystemConsole$.ReadLine();]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
2. Open Visual Studio, [Tool] > [Code Snippets Manager]3. [Import] > select the .snippet file > [Finish] > [OK]
4. Type "cr" and [TAB] twice as Console.Readline hotkey
credit: Johan
留言
張貼留言