Skip to content

Commit

Permalink
Fix netcore3.1 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Feb 4, 2024
1 parent fb38471 commit cda126c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GalaxyBudsClient/Utils/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class ReflectionUtils
/// <returns>PropertyValue</returns>
public static T? GetPropertyValue<T>(this object obj, string propName)
{
ArgumentNullException.ThrowIfNull(obj);
if(obj == null) throw new ArgumentNullException(nameof(obj));
var pi = obj.GetType().GetProperty(propName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
if (pi == null) throw new ArgumentOutOfRangeException("propName", string.Format("Property {0} was not found in Type {1}", propName, obj.GetType().FullName));
return (T?)pi.GetValue(obj, null);
Expand All @@ -31,7 +31,7 @@ public static class ReflectionUtils
/// <returns>PropertyValue</returns>
public static T? GetFieldValue<T>(this object obj, string propName)
{
ArgumentNullException.ThrowIfNull(obj);
if(obj == null) throw new ArgumentNullException(nameof(obj));
var t = obj.GetType();
FieldInfo? fi = null;
while (fi == null && t != null)
Expand Down

0 comments on commit cda126c

Please sign in to comment.