vscode代码片段记录 C#

发布时间:2024年01月23日
{
		"Debug.Log": { // 这里显示输出d给的代码提示窗口中的显示内容,附图在下
		"prefix": "d", // 首先按下的键,拿这个举例则是输出一个d然后回车或者tab即出现Debug.Log();
		"body": [
			"Debug.Log($1);"
		],
		"description": "Log output to debug"
	},
		"if语句": {
		"prefix": "if",
		"body": [
			"if($1) {",
			"   $2$0",
			"}"
		],
		"description": "Output  'if'"
	},
		"for循环": {
		"prefix": "for",
		"body": [
			"for (int i = 0; i < $1; i++) {",
			"   $2$0",
			"}"
		],
		"description": "Output Loop 'fori'"
	},
		"foreach循环": {
		"prefix": "fore",
		"body": [
			"foreach (var item in collection) {",
			"   $2$0",
			"}"
		],
		"description": "Output Loop 'foreach'"
	},
		"switch": {
		"prefix": "sw",
		"body": [
			"switch (switch_on) {",
			"   $2$0",
			"	default:",
            " 		break;",
			"}"
		],
		"description": "Output 'switch'"
	},
		"快捷创建方法": {
		"prefix": "void",
		"body": [
			"void name() {",
			"   $2$0",
			"}"
		],
		"description": "Output 'void'"
	},
		"快捷创建协程": {
		"prefix": "ien",
		"body": [
			"IEnumerator name() {",
			"   yield return null;",
			"}"
		],
		"description": "Output 'IEnumerator'"
	},
		"获取组件": {
		"prefix": "gc",
		"body": [
			"GetComponent<$1>($2)",
		],
		"description": "Output 'GetComponent'"
	},
		"延迟条件等待": {
		"prefix": "wait",
		"body": [
			"yield return new WaitUntil(() => $1);",
		],
		"description": "Output 'WaitUntil'"
	},
		"延迟时间等待": {
		"prefix": "waitfor",
		"body": [
			"yield return new WaitForSeconds($1);",
		],
		"description": "Output 'WaitForSeconds'"
	},
		"创建字典": {
		"prefix": "dic",
		"body": [
			"Dictionary<$1 , $2> dic = new Dictionary<$1 , $2>();",
		],
		"description": "Output 'Dictionary'"
	},
		"创建列表": {
		"prefix": "list",
		"body": [
			"List<$1> list = new List<$1>();",
		],
		"description": "Output 'list'"
	}
	
}

在这里插入图片描述

文章来源:https://blog.csdn.net/Mediary/article/details/135777690
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。