Skip to content

Commit c289314

Browse files
committed
Add code snippets for C# expression-bodied properties
1 parent ae0878b commit c289314

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

snippets/csharp.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,27 @@
354354
],
355355
"description": "An automatically implemented property. C# 3.0 or higher"
356356
},
357+
"propex": {
358+
"prefix": "propex",
359+
"body": [
360+
"public ${1:int} ${2:MyProperty} => ${3:myVar};",
361+
"$0"
362+
],
363+
"description": "An expression-bodied property without a backing field. C# 6.0 or higher"
364+
},
365+
"propexfull": {
366+
"prefix": "propexfull",
367+
"body": [
368+
"private ${1:int} ${2:myVar};",
369+
"public ${1:int} ${3:MyProperty}",
370+
"{",
371+
"\tget => ${2:myVar};",
372+
"\tset => ${2:myVar} = value;",
373+
"}",
374+
"$0"
375+
],
376+
"description": "An expression-bodied property with a private field. C# 6.0 or higher"
377+
},
357378
"sim": {
358379
"prefix": "sim",
359380
"body": [

0 commit comments

Comments
 (0)