Skip to content

Commit d121ddd

Browse files
authored
Add code snippets for C# expression-bodied properties (#5683)
2 parents cfac77e + 435f8ca commit d121ddd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: snippets/csharp.json

+19
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,25 @@
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};$0"
361+
],
362+
"description": "An expression-bodied property without a backing field. C# 6.0 or higher"
363+
},
364+
"propexfull": {
365+
"prefix": "propexfull",
366+
"body": [
367+
"private ${1:int} ${2:myVar};",
368+
"public ${1:int} ${3:MyProperty}",
369+
"{",
370+
"\tget => ${2:myVar};",
371+
"\tset => ${2:myVar} = value;",
372+
"}$0"
373+
],
374+
"description": "An expression-bodied property with a private field. C# 6.0 or higher"
375+
},
357376
"sim": {
358377
"prefix": "sim",
359378
"body": [

0 commit comments

Comments
 (0)