Skip to content

Commit 7e0afad

Browse files
committed
Switch to C# Collection Expressions. (#6845)
1 parent 62d14d2 commit 7e0afad

File tree

948 files changed

+5342
-9991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

948 files changed

+5342
-9991
lines changed

src/CookieCrumble/src/CookieCrumble/Formatters/ExecutionResultSnapshotValueFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void WriteResponse(IBufferWriter<byte> snapshot)
105105
"You must first set the initial response before you can apply patches.");
106106
}
107107

108-
using var writer = new Utf8JsonWriter(snapshot, new JsonWriterOptions { Indented = true });
108+
using var writer = new Utf8JsonWriter(snapshot, new JsonWriterOptions { Indented = true, });
109109

110110
_json.Remove("hasNext");
111111

src/CookieCrumble/src/CookieCrumble/Formatters/JsonSnapshotValueFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal sealed class JsonSnapshotValueFormatter : ISnapshotValueFormatter
1717
DateFormatHandling = DateFormatHandling.IsoDateFormat,
1818
Culture = CultureInfo.InvariantCulture,
1919
ContractResolver = ChildFirstContractResolver.Instance,
20-
Converters = new List<JsonConverter> { new StringEnumConverter() }
20+
Converters = new List<JsonConverter> { new StringEnumConverter(), },
2121
};
2222

2323
public bool CanHandle(object? value)

src/CookieCrumble/src/CookieCrumble/Snapshot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class Snapshot
3535
});
3636
private static readonly JsonSnapshotValueFormatter _defaultFormatter = new();
3737

38-
private readonly List<SnapshotSegment> _segments = new();
38+
private readonly List<SnapshotSegment> _segments = [];
3939
private readonly string _fileName;
4040
private string _extension;
4141
private string? _postFix;

src/CookieCrumble/src/CookieCrumble/packages.lock.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
},
4848
"BananaCakePop.Middleware": {
4949
"type": "Transitive",
50-
"resolved": "10.0.7",
51-
"contentHash": "vksP+PnWLFnsNe3PrD9MufF3zb9y6OcHEmEFjLG87sYaVowzBhos7r+beF0OJleidTeAsinNop9Lt/yMGqKkCA==",
50+
"resolved": "13.0.0",
51+
"contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==",
5252
"dependencies": {
5353
"Yarp.ReverseProxy": "2.0.1"
5454
}
@@ -1130,7 +1130,7 @@
11301130
"hotchocolate.aspnetcore": {
11311131
"type": "Project",
11321132
"dependencies": {
1133-
"BananaCakePop.Middleware": "[10.0.7, )",
1133+
"BananaCakePop.Middleware": "[13.0.0, )",
11341134
"HotChocolate": "[0.0.0, )",
11351135
"HotChocolate.Subscriptions.InMemory": "[0.0.0, )",
11361136
"HotChocolate.Transport.Sockets": "[0.0.0, )",
@@ -1342,8 +1342,8 @@
13421342
},
13431343
"BananaCakePop.Middleware": {
13441344
"type": "Transitive",
1345-
"resolved": "10.0.7",
1346-
"contentHash": "vksP+PnWLFnsNe3PrD9MufF3zb9y6OcHEmEFjLG87sYaVowzBhos7r+beF0OJleidTeAsinNop9Lt/yMGqKkCA==",
1345+
"resolved": "13.0.0",
1346+
"contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==",
13471347
"dependencies": {
13481348
"Yarp.ReverseProxy": "2.0.1"
13491349
}
@@ -2437,7 +2437,7 @@
24372437
"hotchocolate.aspnetcore": {
24382438
"type": "Project",
24392439
"dependencies": {
2440-
"BananaCakePop.Middleware": "[10.0.7, )",
2440+
"BananaCakePop.Middleware": "[13.0.0, )",
24412441
"HotChocolate": "[0.0.0, )",
24422442
"HotChocolate.Subscriptions.InMemory": "[0.0.0, )",
24432443
"HotChocolate.Transport.Sockets": "[0.0.0, )",
@@ -2689,8 +2689,8 @@
26892689
},
26902690
"BananaCakePop.Middleware": {
26912691
"type": "Transitive",
2692-
"resolved": "10.0.7",
2693-
"contentHash": "vksP+PnWLFnsNe3PrD9MufF3zb9y6OcHEmEFjLG87sYaVowzBhos7r+beF0OJleidTeAsinNop9Lt/yMGqKkCA==",
2692+
"resolved": "13.0.0",
2693+
"contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==",
26942694
"dependencies": {
26952695
"Yarp.ReverseProxy": "2.0.1"
26962696
}
@@ -3851,7 +3851,7 @@
38513851
"hotchocolate.aspnetcore": {
38523852
"type": "Project",
38533853
"dependencies": {
3854-
"BananaCakePop.Middleware": "[10.0.7, )",
3854+
"BananaCakePop.Middleware": "[13.0.0, )",
38553855
"HotChocolate": "[0.0.0, )",
38563856
"HotChocolate.Subscriptions.InMemory": "[0.0.0, )",
38573857
"HotChocolate.Transport.Sockets": "[0.0.0, )",

src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public void SnapshotBuilder()
4848
{
4949
var snapshot = new Snapshot();
5050
snapshot.Add(new MyClass());
51-
snapshot.Add(new MyClass { Foo = "Bar" });
52-
snapshot.Add(new MyClass { Foo = "Baz" });
51+
snapshot.Add(new MyClass { Foo = "Bar", });
52+
snapshot.Add(new MyClass { Foo = "Baz", });
5353
snapshot.Match();
5454
}
5555

@@ -58,8 +58,8 @@ public async Task SnapshotBuilderAsync()
5858
{
5959
var snapshot = new Snapshot();
6060
snapshot.Add(new MyClass());
61-
snapshot.Add(new MyClass { Foo = "Bar" });
62-
snapshot.Add(new MyClass { Foo = "Baz" });
61+
snapshot.Add(new MyClass { Foo = "Bar", });
62+
snapshot.Add(new MyClass { Foo = "Baz", });
6363
await snapshot.MatchAsync();
6464
}
6565

@@ -68,8 +68,8 @@ public void SnapshotBuilder_Segment_Name()
6868
{
6969
var snapshot = new Snapshot();
7070
snapshot.Add(new MyClass());
71-
snapshot.Add(new MyClass { Foo = "Bar" }, "Bar:");
72-
snapshot.Add(new MyClass { Foo = "Baz" });
71+
snapshot.Add(new MyClass { Foo = "Bar", }, "Bar:");
72+
snapshot.Add(new MyClass { Foo = "Baz", });
7373
snapshot.Match();
7474
}
7575

@@ -78,8 +78,8 @@ public void SnapshotBuilder_Segment_Name_All()
7878
{
7979
var snapshot = new Snapshot();
8080
snapshot.Add(new MyClass(), "Segment 1:");
81-
snapshot.Add(new MyClass { Foo = "Bar" }, "Segment 2:");
82-
snapshot.Add(new MyClass { Foo = "Baz" }, "Segment 3:");
81+
snapshot.Add(new MyClass { Foo = "Bar", }, "Segment 2:");
82+
snapshot.Add(new MyClass { Foo = "Baz", }, "Segment 3:");
8383
snapshot.Match();
8484
}
8585

@@ -88,9 +88,9 @@ public void SnapshotBuilder_Segment_Custom_Serializer_For_Segment()
8888
{
8989
var snapshot = new Snapshot();
9090
snapshot.Add(new MyClass());
91-
snapshot.Add(new MyClass { Foo = "Baz" }, "Bar:", new CustomSerializer());
92-
snapshot.Add(new MyClass { Foo = "Baz" });
93-
snapshot.Add(new MyClass { Foo = "Baz" });
91+
snapshot.Add(new MyClass { Foo = "Baz", }, "Bar:", new CustomSerializer());
92+
snapshot.Add(new MyClass { Foo = "Baz", });
93+
snapshot.Add(new MyClass { Foo = "Baz", });
9494
snapshot.Match();
9595
}
9696

@@ -100,15 +100,15 @@ public void SnapshotBuilder_Segment_Custom_Global_Serializer()
100100
Snapshot.RegisterFormatter(new CustomSerializer());
101101

102102
var snapshot = new Snapshot();
103-
snapshot.Add(new MyClass { Foo = "123" });
103+
snapshot.Add(new MyClass { Foo = "123", });
104104
snapshot.Match();
105105
}
106106

107107
[Fact]
108108
public void SnapshotBuilder_GraphQL_Segment()
109109
{
110110
var snapshot = new Snapshot();
111-
snapshot.Add(new MyClass { Foo = "def" });
111+
snapshot.Add(new MyClass { Foo = "def", });
112112
snapshot.Add(Utf8GraphQLParser.Parse("{ abc }"));
113113
snapshot.Match();
114114
}
@@ -121,7 +121,7 @@ public class MyClass
121121
public class CustomSerializer : ISnapshotValueFormatter
122122
{
123123
public bool CanHandle(object? value)
124-
=> value is MyClass { Foo: "123" };
124+
=> value is MyClass { Foo: "123", };
125125

126126
public void Format(IBufferWriter<byte> snapshot, object? value)
127127
{

src/CookieCrumble/test/CookieCrumble.Tests/packages.lock.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
},
4848
"BananaCakePop.Middleware": {
4949
"type": "Transitive",
50-
"resolved": "10.0.7",
51-
"contentHash": "vksP+PnWLFnsNe3PrD9MufF3zb9y6OcHEmEFjLG87sYaVowzBhos7r+beF0OJleidTeAsinNop9Lt/yMGqKkCA==",
50+
"resolved": "13.0.0",
51+
"contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==",
5252
"dependencies": {
5353
"Yarp.ReverseProxy": "2.0.1"
5454
}
@@ -1194,7 +1194,7 @@
11941194
"hotchocolate.aspnetcore": {
11951195
"type": "Project",
11961196
"dependencies": {
1197-
"BananaCakePop.Middleware": "[10.0.7, )",
1197+
"BananaCakePop.Middleware": "[13.0.0, )",
11981198
"HotChocolate": "[0.0.0, )",
11991199
"HotChocolate.Subscriptions.InMemory": "[0.0.0, )",
12001200
"HotChocolate.Transport.Sockets": "[0.0.0, )",
@@ -1406,8 +1406,8 @@
14061406
},
14071407
"BananaCakePop.Middleware": {
14081408
"type": "Transitive",
1409-
"resolved": "10.0.7",
1410-
"contentHash": "vksP+PnWLFnsNe3PrD9MufF3zb9y6OcHEmEFjLG87sYaVowzBhos7r+beF0OJleidTeAsinNop9Lt/yMGqKkCA==",
1409+
"resolved": "13.0.0",
1410+
"contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==",
14111411
"dependencies": {
14121412
"Yarp.ReverseProxy": "2.0.1"
14131413
}
@@ -2566,7 +2566,7 @@
25662566
"hotchocolate.aspnetcore": {
25672567
"type": "Project",
25682568
"dependencies": {
2569-
"BananaCakePop.Middleware": "[10.0.7, )",
2569+
"BananaCakePop.Middleware": "[13.0.0, )",
25702570
"HotChocolate": "[0.0.0, )",
25712571
"HotChocolate.Subscriptions.InMemory": "[0.0.0, )",
25722572
"HotChocolate.Transport.Sockets": "[0.0.0, )",
@@ -2818,8 +2818,8 @@
28182818
},
28192819
"BananaCakePop.Middleware": {
28202820
"type": "Transitive",
2821-
"resolved": "10.0.7",
2822-
"contentHash": "vksP+PnWLFnsNe3PrD9MufF3zb9y6OcHEmEFjLG87sYaVowzBhos7r+beF0OJleidTeAsinNop9Lt/yMGqKkCA==",
2821+
"resolved": "13.0.0",
2822+
"contentHash": "6Zj/vfmnCXLjBG7WNdtOgZZ5ZDR3Sy1FQSshZUonIYs3OdzozmsFmqPXMd9XJ0QE9aAildgVGq/lDLpLrMI4Yw==",
28232823
"dependencies": {
28242824
"Yarp.ReverseProxy": "2.0.1"
28252825
}
@@ -4045,7 +4045,7 @@
40454045
"hotchocolate.aspnetcore": {
40464046
"type": "Project",
40474047
"dependencies": {
4048-
"BananaCakePop.Middleware": "[10.0.7, )",
4048+
"BananaCakePop.Middleware": "[13.0.0, )",
40494049
"HotChocolate": "[0.0.0, )",
40504050
"HotChocolate.Subscriptions.InMemory": "[0.0.0, )",
40514051
"HotChocolate.Transport.Sockets": "[0.0.0, )",

src/GreenDonut/src/Core/Batch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace GreenDonut;
55

66
internal class Batch<TKey> where TKey : notnull
77
{
8-
private readonly List<TKey> _keys = new();
8+
private readonly List<TKey> _keys = [];
99
private readonly Dictionary<TKey, object> _items = new();
1010

1111
public int Size => _keys.Count;

src/GreenDonut/src/Core/CacheDataLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected CacheDataLoader(DataLoaderOptions? options = null)
1515
: base(
1616
AutoBatchScheduler.Default,
1717
options is null
18-
? new DataLoaderOptions { MaxBatchSize = 1 }
18+
? new DataLoaderOptions { MaxBatchSize = 1, }
1919
: CreateLocalOptions(options))
2020
{ }
2121

src/GreenDonut/src/Core/TaskCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private Entry AddNewEntry(TaskCacheKey key, Task value)
144144
{
145145
lock (_sync)
146146
{
147-
var entry = new Entry { Key = key, Value = value };
147+
var entry = new Entry { Key = key, Value = value, };
148148
AppendEntryUnsafe(entry);
149149
ClearSpaceForNewEntryUnsafe();
150150
return entry;

0 commit comments

Comments
 (0)