mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-23 00:28:48 +00:00
Allow nullable Uri
This commit is contained in:
parent
ed98531950
commit
5019ef94b0
@ -1,18 +1,18 @@
|
|||||||
namespace VpSharp.Internal.ValueConverters;
|
namespace VpSharp.Internal.ValueConverters;
|
||||||
|
|
||||||
#pragma warning disable CA1812
|
#pragma warning disable CA1812
|
||||||
|
|
||||||
internal sealed class UriConverter : ValueConverter<Uri>
|
internal sealed class UriConverter : ValueConverter<Uri?>
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Deserialize(TextReader reader, out Uri result)
|
public override void Deserialize(TextReader reader, out Uri? result)
|
||||||
{
|
{
|
||||||
string url = reader.ReadToEnd();
|
string url = reader.ReadToEnd();
|
||||||
result = string.IsNullOrWhiteSpace(url) ? null : new Uri(url);
|
result = string.IsNullOrWhiteSpace(url) ? null : new Uri(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Serialize(TextWriter writer, Uri value)
|
public override void Serialize(TextWriter writer, Uri? value)
|
||||||
{
|
{
|
||||||
if (value is not null)
|
if (value is not null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user