Fix cache not actually caching anything

This commit is contained in:
Dean Herbert 2021-09-09 14:56:39 +09:00
parent a622a0b660
commit 41a2e6eeeb

View File

@ -168,14 +168,14 @@ namespace osu.Game.Configuration
}
}
private static readonly ConcurrentDictionary<Type, IEnumerable<(SettingSourceAttribute, PropertyInfo)>> property_info_cache = new ConcurrentDictionary<Type, IEnumerable<(SettingSourceAttribute, PropertyInfo)>>();
private static readonly ConcurrentDictionary<Type, (SettingSourceAttribute, PropertyInfo)[]> property_info_cache = new ConcurrentDictionary<Type, (SettingSourceAttribute, PropertyInfo)[]>();
public static IEnumerable<(SettingSourceAttribute, PropertyInfo)> GetSettingsSourceProperties(this object obj)
{
var type = obj.GetType();
if (!property_info_cache.TryGetValue(type, out var properties))
property_info_cache[type] = properties = getSettingsSourceProperties(type);
property_info_cache[type] = properties = getSettingsSourceProperties(type).ToArray();
return properties;
}