Skip to content

Commit a67f94a

Browse files
authored
Enhance copilot instructions for C# best practices (#2586)
1 parent 78b209a commit a67f94a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/copilot-instructions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ if (something is Bucket bucket)
8282
}
8383
```
8484

85+
### Use collection initializers or expressions
86+
* Use [Use collection initializers or expressions](https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/ide0028) Use collection initializers or expressions.
87+
88+
e.g.
89+
90+
```csharp
91+
List<int> list = [1, 2, 3];
92+
List<int> list = [];
93+
```
94+
8595
### File Scoped Namespaces
8696
* Use [file scoped namespaces](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces) to help reduce code verbosity.
8797

0 commit comments

Comments
 (0)