add ToPropertyDictionary to convert Dictionary<string, object?> to Dictionary<string, string?>
This commit is contained in:
@@ -15,6 +15,14 @@ public static class ObjectExtensions
|
|||||||
prop => prop.GetValue(obj).ToSafeString()
|
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)
|
public static string? ToSafeString(this object? obj)
|
||||||
=> obj is bool b
|
=> obj is bool b
|
||||||
|
|||||||
Reference in New Issue
Block a user