Allow subscription keys to be resolved by reflection

This commit is contained in:
TheXamlGuy
2024-06-02 18:48:51 +01:00
parent 48b33416c9
commit 1a0d750f02
4 changed files with 26 additions and 13 deletions
+2 -3
View File
@@ -8,9 +8,8 @@ public static class ObjectExtensions
{
Type type = obj.GetType();
object? key = selector();
if (type.GetProperty($"{key}") is PropertyInfo property
&& property.GetValue(obj) is { } value)
object? key = selector();
if (type.GetProperty($"{key}") is PropertyInfo property && property.GetValue(obj) is { } value)
{
return value;
}