1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-22 13:48:48 +00:00

Allow nullable Uri

This commit is contained in:
Oliver Booth 2022-11-30 18:18:20 +00:00
parent ed98531950
commit 5019ef94b0
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -1,18 +1,18 @@
namespace VpSharp.Internal.ValueConverters;
namespace VpSharp.Internal.ValueConverters;
#pragma warning disable CA1812
internal sealed class UriConverter : ValueConverter<Uri>
internal sealed class UriConverter : ValueConverter<Uri?>
{
/// <inheritdoc />
public override void Deserialize(TextReader reader, out Uri result)
public override void Deserialize(TextReader reader, out Uri? result)
{
string url = reader.ReadToEnd();
result = string.IsNullOrWhiteSpace(url) ? null : new Uri(url);
}
/// <inheritdoc />
public override void Serialize(TextWriter writer, Uri value)
public override void Serialize(TextWriter writer, Uri? value)
{
if (value is not null)
{