1、打开代码管理器
2、打开后就可以看到如下图所示
3、复制粘贴该路径,转到该文件夹下
新加一个txt文件,把下面的文本复制粘贴
<?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的代码片段复制粘贴,大胆修改后成功的。
愿大家的学习一路顺风。
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论