From c2893148b9c891ce61f89efaeb2dc8ee6ec88df2 Mon Sep 17 00:00:00 2001 From: Navid Date: Tue, 16 May 2023 18:50:15 +0330 Subject: [PATCH] Add code snippets for C# expression-bodied properties --- snippets/csharp.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/snippets/csharp.json b/snippets/csharp.json index c729dc32c..68eafa797 100644 --- a/snippets/csharp.json +++ b/snippets/csharp.json @@ -354,6 +354,27 @@ ], "description": "An automatically implemented property. C# 3.0 or higher" }, + "propex": { + "prefix": "propex", + "body": [ + "public ${1:int} ${2:MyProperty} => ${3:myVar};", + "$0" + ], + "description": "An expression-bodied property without a backing field. C# 6.0 or higher" + }, + "propexfull": { + "prefix": "propexfull", + "body": [ + "private ${1:int} ${2:myVar};", + "public ${1:int} ${3:MyProperty}", + "{", + "\tget => ${2:myVar};", + "\tset => ${2:myVar} = value;", + "}", + "$0" + ], + "description": "An expression-bodied property with a private field. C# 6.0 or higher" + }, "sim": { "prefix": "sim", "body": [