use prim ctor and fixed warnings: Botcontroller and effected classes

This commit is contained in:
CWX
2025-01-18 14:52:15 +00:00
parent a3d3d6490f
commit 6d5ff3af2d
7 changed files with 118 additions and 91 deletions
+4 -1
View File
@@ -27,8 +27,11 @@ namespace Core.Utils.Extensions
return TryGetCachedProperty(obj.GetType(), key.ToString(), out _);
}
public static T? Get<T>(this object obj, string toLower)
public static T? Get<T>(this object? obj, string? toLower)
{
ArgumentNullException.ThrowIfNull(obj);
ArgumentNullException.ThrowIfNull(toLower);
if (!TryGetCachedProperty(obj.GetType(), toLower, out var cachedProperty))
return default;
return (T?)cachedProperty.GetValue(obj);