@@ -6,9 +6,9 @@ namespace Celeste.Mod.SpeedrunTool.SaveLoad;
66
77internal static class DynDataUtils {
88 // DynData
9- private static readonly Dictionary < Type , object > CachedDataMaps = new ( ) ;
10- public static ConditionalWeakTable < object , object > IgnoreObjects = new ( ) ;
11- private static readonly HashSet < Type > IgnoreTypes = new ( ) ;
9+ private static readonly Dictionary < Type , object > CachedDataMaps = [ ] ;
10+ public static ConditionalWeakTable < object , object > IgnoreObjects = [ ] ;
11+ private static readonly HashSet < Type > IgnoreTypes = [ ] ;
1212
1313 private static readonly Lazy < int > EmptyTableEntriesLength =
1414 new ( ( ) => new ConditionalWeakTable < object , object > ( ) . GetFieldValue < Array > ( "_entries" ) . Length ) ;
@@ -19,7 +19,7 @@ internal static class DynDataUtils {
1919 private static Func < object , bool > checkEmpty ;
2020
2121 public static void ClearCached ( ) {
22- IgnoreObjects = new ConditionalWeakTable < object , object > ( ) ;
22+ IgnoreObjects = [ ] ;
2323 IgnoreTypes . Clear ( ) ;
2424 }
2525
@@ -29,7 +29,7 @@ public static bool NotExistDynData(Type type, out object dataMap) {
2929 return true ;
3030 }
3131
32- dataMap = GetDataMap ( type ) ;
32+ dataMap = GetDataMap ( type ) ;
3333 if ( CheckEmpty ( dataMap ) ) {
3434 IgnoreTypes . Add ( type ) ;
3535 return true ;
@@ -43,16 +43,16 @@ private static bool CheckEmpty(object weakTable) {
4343 if ( checkEmpty == null ) {
4444 if ( Type . GetType ( "Mono.Runtime" ) != null ) {
4545 // Mono
46- checkEmpty = o => o . GetFieldValue < int > ( "size" ) == 0 ;
46+ checkEmpty = static o => o . GetFieldValue < int > ( "size" ) == 0 ;
4747 }
4848 else if ( weakTable . GetType ( ) . GetFieldInfo ( "_entries" ) != null ) {
4949 // .net framework
50- checkEmpty = o => o . GetFieldValue < Array > ( "_entries" ) . Length == EmptyTableEntriesLength . Value &&
50+ checkEmpty = static o => o . GetFieldValue < Array > ( "_entries" ) . Length == EmptyTableEntriesLength . Value &&
5151 o . GetFieldValue < int > ( "_freeList" ) == EmptyTableFreeList . Value ;
5252 }
5353 else {
5454 // .net7
55- checkEmpty = o => o . GetFieldValue ( "_container" ) is { } container && container . GetFieldValue < Array > ( "_entries" ) . Length == EmptyContainerEntriesLength . Value &&
55+ checkEmpty = static o => o . GetFieldValue ( "_container" ) is { } container && container . GetFieldValue < Array > ( "_entries" ) . Length == EmptyContainerEntriesLength . Value &&
5656 container . GetFieldValue < int > ( "_firstFreeEntry" ) == EmptyContainerFirstFreeEntry . Value ;
5757 }
5858 }
0 commit comments