Skip to content

Commit 6f1d36e

Browse files
committed
Update CSharp 13.0
1 parent 0467dca commit 6f1d36e

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
2020
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2121

22-
<LangVersion>9.0</LangVersion>
22+
<LangVersion>13.0</LangVersion>
2323
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
2424
<GenerateDocumentationFile>false</GenerateDocumentationFile>
2525
</PropertyGroup>

Testing.Dynamic.Json/DJsonArray.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ namespace Testing.Dynamic
77
[JsonConverter(typeof(DJsonArrayJsonConverter))]
88
public class DJsonArray : DJson
99
{
10-
private readonly List<object> _list = new();
10+
private readonly List<object> _list = [];
1111

12-
internal DJsonArray(IEnumerable<object> list = null) => _list = list?.ToList() ?? new();
12+
internal DJsonArray(IEnumerable<object> list = null) => _list = list?.ToList() ?? [];
1313

1414
public override int CountMembers => _list.Count;
1515

Testing.Dynamic.Json/DJsonObject.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Testing.Dynamic
88
[JsonConverter(typeof(DJsonObjectJsonConverter))]
99
public class DJsonObject : DJson
1010
{
11-
private readonly Dictionary<string, object> _dict = new();
11+
private readonly Dictionary<string, object> _dict = [];
1212
private readonly Dictionary<string, object> _dict2 = new(StringComparer.OrdinalIgnoreCase);
1313

1414
internal DJsonObject() { }
@@ -17,18 +17,9 @@ internal DJsonObject() { }
1717

1818
public override bool TryGetMember(GetMemberBinder binder, out object result)
1919
{
20-
if (binder.IgnoreCase && _dict2.TryGetValue(binder.Name, out var value1))
21-
{
22-
result = value1;
23-
}
24-
else if (!binder.IgnoreCase && _dict.TryGetValue(binder.Name, out var value2))
25-
{
26-
result = value2;
27-
}
28-
else
29-
{
30-
result = null;
31-
}
20+
result = binder.IgnoreCase && _dict2.TryGetValue(binder.Name, out var value1)
21+
? value1
22+
: !binder.IgnoreCase && _dict.TryGetValue(binder.Name, out var value2) ? value2 : null;
3223
return true;
3324
}
3425

Testing.Dynamic.Json/Helper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public static DJsonObject ConvertObject(JsonElement jsonElement)
2929
}
3030

3131
public static DJsonArray ConvertArray(JsonElement jsonElement)
32-
=> new DJsonArray(jsonElement.EnumerateArray().Select(e => Convert(e)));
32+
=> new(jsonElement.EnumerateArray().Select(e => Convert(e)));
3333
}
3434
}

0 commit comments

Comments
 (0)