pentest-distro-builder/filesystem/etc/skel/.vscode/extensions/ms-vscode.csharp-1.16.1/snippets/csharp.json

477 lines
No EOL
13 KiB
JSON

{
"Attribute using recommended pattern": {
"prefix": "attribute",
"body": [
"[System.AttributeUsage(System.AttributeTargets.${1:All}, Inherited = ${2:false}, AllowMultiple = ${3:true})]",
"sealed class ${4:My}Attribute : System.Attribute",
"{",
" // See the attribute guidelines at",
" // http://go.microsoft.com/fwlink/?LinkId=85236",
" readonly string positionalString;",
" ",
" // This is a positional argument",
" public ${4:My}Attribute(string positionalString)",
" {",
" this.positionalString = positionalString;",
" ",
" // TODO: Implement code here",
" ${5:throw new System.NotImplementedException();}",
" }",
" ",
" public string PositionalString",
" {",
" get { return positionalString; }",
" }",
" ",
" // This is a named argument",
" public int NamedInt { get; set; }",
"}"
],
"description": "Attribute using recommended pattern"
},
"Checked block": {
"prefix": "checked",
"body": [
"checked",
"{",
" $0",
"}"
],
"description": "Checked block"
},
"Class": {
"prefix": "class",
"body": [
"class ${1:Name}",
"{",
" $0",
"}"
],
"description": "Class"
},
"Console.WriteLine": {
"prefix": "cw",
"body": [
"System.Console.WriteLine($0);"
],
"description": "Console.WriteLine"
},
"do...while loop": {
"prefix": "do",
"body": [
"do",
"{",
" $0",
"} while (${1:true});"
],
"description": "do...while loop"
},
"Else statement": {
"prefix": "else",
"body": [
"else",
"{",
" $0",
"}"
],
"description": "Else statement"
},
"Enum": {
"prefix": "enum",
"body": [
"enum ${1:Name}",
"{",
" $0",
"}"
],
"description": "Enum"
},
"Implementing Equals() according to guidelines": {
"prefix": "equals",
"body": [
"// override object.Equals",
"public override bool Equals(object obj)",
"{",
" //",
" // See the full list of guidelines at",
" // http://go.microsoft.com/fwlink/?LinkID=85237",
" // and also the guidance for operator== at",
" // http://go.microsoft.com/fwlink/?LinkId=85238",
" //",
" ",
" if (obj == null || GetType() != obj.GetType())",
" {",
" return false;",
" }",
" ",
" // TODO: write your implementation of Equals() here",
" ${1:throw new System.NotImplementedException();}",
" return base.Equals (obj);",
"}",
"",
"// override object.GetHashCode",
"public override int GetHashCode()",
"{",
" // TODO: write your implementation of GetHashCode() here",
" ${2:throw new System.NotImplementedException();}",
" return base.GetHashCode();",
"}"
],
"description": "Implementing Equals() according to guidelines"
},
"Exception": {
"prefix": "exception",
"body": [
"[System.Serializable]",
"public class ${1:My}Exception : ${2:System.Exception}",
"{",
" public ${1:My}Exception() { }",
" public ${1:My}Exception(string message) : base(message) { }",
" public ${1:My}Exception(string message, System.Exception inner) : base(message, inner) { }",
" protected ${1:My}Exception(",
" System.Runtime.Serialization.SerializationInfo info,",
" System.Runtime.Serialization.StreamingContext context) : base(info, context) { }",
"}"
],
"description": "Exception"
},
"Foreach statement": {
"prefix": "foreach",
"body": [
"foreach (${1:var} ${2:item} in ${3:collection})",
"{",
" $0",
"}"
],
"description": "Foreach statement"
},
"Reverse for loop": {
"prefix": "forr",
"body": [
"for (int ${1:i} = ${2:length} - 1; ${1:i} >= 0 ; ${1:i}--)",
"{",
" $0",
"}"
],
"description": "Reverse for loop"
},
"for loop": {
"prefix": "for",
"body": [
"for (int ${1:i} = 0; ${1:i} < ${2:length}; ${1:i}++)",
"{",
" $0",
"}"
],
"description": "for loop"
},
"if statement": {
"prefix": "if",
"body": [
"if (${1:true})",
"{",
" $0",
"}"
],
"description": "if statement"
},
"Indexer": {
"prefix": "indexer",
"body": [
"${1:public} ${2:object} this[${3:int} index]",
"{",
" get { $4 }",
" set { $0 }",
"}"
],
"description": "Indexer"
},
"Interface": {
"prefix": "interface",
"body": [
"interface I${1:Name}",
"{",
" $0",
"}"
],
"description": "Interface"
},
"Safely invoking an event": {
"prefix": "invoke",
"body": [
"${1:EventHandler} temp = ${2:MyEvent};",
"if (temp != null)",
"{",
" temp($0);",
"}"
],
"description": "Safely invoking an event"
},
"Simple iterator": {
"prefix": "iterator",
"body": [
"public System.Collections.Generic.IEnumerator<${1:ElementType}> GetEnumerator()",
"{",
" $0throw new System.NotImplementedException();",
" yield return default(${1:ElementType});",
"}"
],
"description": "Simple iterator"
},
"Named iterator/indexer pair using a nested class": {
"prefix": "iterindex",
"body": [
"public ${1:Name}Iterator ${1:Name}",
"{",
" get",
" {",
" return new ${1:Name}Iterator(this);",
" }",
"}",
"",
"public class ${1:Name}Iterator",
"{",
" readonly ${2:ClassName} outer;",
" ",
" internal ${1:Name}Iterator(${2:ClassName} outer)",
" {",
" this.outer = outer;",
" }",
" ",
" // TODO: provide an appropriate implementation here",
" public int Length { get { return 1; } }",
" ",
" public ${3:ElementType} this[int index]",
" {",
" get",
" {",
" //",
" // TODO: implement indexer here",
" //",
" // you have full access to ${2:ClassName} privates",
" //",
" ${4:throw new System.NotImplementedException();}",
" return default(${3:ElementType});",
" }",
" }",
" ",
" public System.Collections.Generic.IEnumerator<${3:ElementType}> GetEnumerator()",
" {",
" for (int i = 0; i < this.Length; i++)",
" {",
" yield return this[i];",
" }",
" }",
"}"
],
"description": "Named iterator/indexer pair using a nested class"
},
"Lock statement": {
"prefix": "lock",
"body": [
"lock (${1:this})",
"{",
" $0",
"}"
],
"description": "Lock statement"
},
"MessageBox.Show": {
"prefix": "mbox",
"body": [
"System.Windows.Forms.MessageBox.Show(\"${1:Text}\");$0"
],
"description": "MessageBox.Show"
},
"Namespace": {
"prefix": "namespace",
"body": [
"namespace ${1:Name}",
"{",
" $0",
"}"
],
"description": "Namespace"
},
"#if": {
"prefix": "ifd",
"body": [
"#if ${1:true}",
" $0",
"#endif"
],
"description": "#if"
},
"#region": {
"prefix": "region",
"body": [
"#region ${1:Name}",
" $0",
"#endregion"
],
"description": "#region"
},
"Property and backing field": {
"prefix": "propfull",
"body": [
"private ${1:int} ${2:myVar};",
"public ${1:int} ${3:MyProperty}",
"{",
" get { return ${2:myVar};}",
" set { ${2:myVar} = value;}",
"}",
"$0"
],
"description": "Property and backing field"
},
"propg": {
"prefix": "propg",
"body": [
"public ${1:int} ${2:MyProperty} { get; private set; }$0"
],
"description": "An automatically implemented property with a 'get' accessor and a private 'set' accessor. C# 3.0 or higher"
},
"prop": {
"prefix": "prop",
"body": [
"public ${1:int} ${2:MyProperty} { get; set; }$0"
],
"description": "An automatically implemented property. C# 3.0 or higher"
},
"sim": {
"prefix": "sim",
"body": [
"static int Main(string[] args)",
"{",
" $0",
" return 0;",
"}"
],
"description": "int Main()"
},
"Struct": {
"prefix": "struct",
"body": [
"struct ${1:Name}",
"{",
" $0",
"}"
],
"description": "Struct"
},
"svm": {
"prefix": "svm",
"body": [
"static void Main(string[] args)",
"{",
" $0",
"}"
],
"description": "void Main()"
},
"Switch statement": {
"prefix": "switch",
"body": [
"switch (${1:switch_on})",
"{",
" $0",
" default:",
"}"
],
"description": "Switch statement"
},
"Try finally": {
"prefix": "tryf",
"body": [
"try",
"{",
" $1",
"}",
"finally",
"{",
" $0",
"}"
],
"description": "Try finally"
},
"Try catch": {
"prefix": "try",
"body": [
"try",
"{",
" $1",
"}",
"catch (${2:System.Exception})",
"{",
" $0",
" throw;",
"}"
],
"description": "Try catch"
},
"Unchecked block": {
"prefix": "unchecked",
"body": [
"unchecked",
"{",
" $0",
"}"
],
"description": "Unchecked block"
},
"Unsafe statement": {
"prefix": "unsafe",
"body": [
"unsafe",
"{",
" $0",
"}"
],
"description": "Unsafe statement"
},
"Using statement": {
"prefix": "using",
"body": [
"using (${1:resource})",
"{",
" $0",
"}"
],
"description": "Using statement"
},
"While loop": {
"prefix": "while",
"body": [
"while (${1:true})",
"{",
" $0",
"}"
],
"description": "While loop"
},
"constructor": {
"prefix": "ctor",
"body": [
"${1:public} ${2:ClassName}(${3:Parameters})",
"{",
" $0",
"}"
],
"description": "constructor"
},
"xUnit Test": {
"prefix": "fact",
"body": [
"[Fact]",
"public void ${1:TestName}()",
"{",
"//Given",
"",
"//When",
"",
"//Then",
"}$0"
],
"description": "create xunit test method"
}
}