File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,16 @@ public SyncedConfig(string guid)
2727 /// </summary>
2828 public string GUID { get ; }
2929
30- internal void PopulateEntryContainer ( )
31- {
32- var fields = AccessTools . GetDeclaredFields ( typeof ( T ) )
30+ private static Lazy < FieldInfo [ ] > SyncedEntryFields = new (
31+ ( ) => AccessTools . GetDeclaredFields ( typeof ( T ) )
3332 . Where ( field => field . GetCustomAttribute < DataMemberAttribute > ( ) is not null )
34- . Where ( field => typeof ( SyncedEntryBase ) . IsAssignableFrom ( field . FieldType ) ) ;
33+ . Where ( field => typeof ( SyncedEntryBase ) . IsAssignableFrom ( field . FieldType ) )
34+ . ToArray ( )
35+ ) ;
3536
36- foreach ( var fieldInfo in fields )
37+ internal void PopulateEntryContainer ( )
38+ {
39+ foreach ( var fieldInfo in SyncedEntryFields . Value )
3740 {
3841 var entryBase = ( SyncedEntryBase ) fieldInfo . GetValue ( this ) ;
3942 EntryContainer . Add ( entryBase . BoxedEntry . ToSyncedEntryIdentifier ( ) , entryBase ) ;
You can’t perform that action at this time.
0 commit comments