File tree Expand file tree Collapse file tree 4 files changed +8
-17
lines changed
Expand file tree Collapse file tree 4 files changed +8
-17
lines changed Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments