Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
tpill90 committed Nov 23, 2024
1 parent 2ded39b commit 2c7297a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BattleNetPrefill/Structs/Enums/EnumBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ public static List<T> AllEnumValues
if (!_invoked)
{
_invoked = true;

#pragma warning disable IL2090
// Force initialization by calling one of the derived fields/properties. Failure to do this will result in this list being empty.
typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Static).FirstOrDefault(p => p.PropertyType == typeof(T))?.GetValue(null, null);
typeof(T).GetFields(BindingFlags.Public | BindingFlags.Static).FirstOrDefault(p => p.FieldType == typeof(T))?.GetValue(null);
#pragma warning restore IL2090

}
return _allEnumValues;
}
Expand Down

0 comments on commit 2c7297a

Please sign in to comment.