add ToPropertyDictionary to convert Dictionary<string, object?> to Dictionary<string, string?>

This commit is contained in:
Developer 02 2025-08-14 17:20:59 +02:00
parent 6cf47dc617
commit 4b8217bb80

View File

@ -15,6 +15,14 @@ public static class ObjectExtensions
prop => prop.GetValue(obj).ToSafeString()
);
}
public static Dictionary<string, string?> ToPropertyDictionary(this Dictionary<string, object?> obj)
{
return obj
.ToDictionary(
prop => prop.Key,
prop => prop.Value?.ToString()
);
}
public static string? ToSafeString(this object? obj)
=> obj is bool b