1、打開代碼管理器
2、打開后就可以看到如下圖所示
3、復制粘貼該路徑,轉到該文件夾下
新加一個txt文件,把下面的文本復制粘貼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<? xml version = "1.0" encoding = "utf-8" ?> < codesnippets xmlns = "http://schemas.microsoft.com/visualstudio/2005/codesnippet" > < codesnippet format = "1.0.0" > < header > < title >ck</ title > < shortcut >ck</ shortcut > < description >console.readkey 的代碼片段</ description > < author >jinglingzi</ 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$.readkey();$end$]]> </ code > </ snippet > </ codesnippet > </ codesnippets > |
把文件的后綴名改為 .snippet.
4、你在寫代碼的地方,ck 然后兩下tab鍵,console.readkey就出來了。
技巧:
5、<code language="csharp"><![cdata[$systemconsole$.readkey();$end$]]>
這行代碼中的,$end$,是光標停止的位置。
6、我其實也不會怎么寫代碼片段,就是把cw的代碼片段復制粘貼,大膽修改后成功的。
愿大家的學習一路順風。