From b29b7e84830ef7cdc5d8e646d242fb3317027eeb Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Mon, 9 Jan 2017 22:09:45 +1300 Subject: [PATCH] -Derp --- Src/Newtonsoft.Json/Linq/JProperty.Async.cs | 26 +++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Src/Newtonsoft.Json/Linq/JProperty.Async.cs b/Src/Newtonsoft.Json/Linq/JProperty.Async.cs index 560eb7ae..c108686c 100644 --- a/Src/Newtonsoft.Json/Linq/JProperty.Async.cs +++ b/Src/Newtonsoft.Json/Linq/JProperty.Async.cs @@ -49,30 +49,22 @@ namespace Newtonsoft.Json.Linq return WriteToAsync(task, writer, cancellationToken, converters); } - JToken value = Value; - if (value != null) - { - return value.WriteToAsync(writer, cancellationToken, converters); - } - else - { - return writer.WriteNullAsync(cancellationToken); - } + return WriteValueAsync(writer, cancellationToken, converters); } private async Task WriteToAsync(Task task, JsonWriter writer, CancellationToken cancellationToken, params JsonConverter[] converters) { await task.ConfigureAwait(false); + await WriteValueAsync(writer, cancellationToken, converters); + } + + private Task WriteValueAsync(JsonWriter writer, CancellationToken cancellationToken, JsonConverter[] converters) + { JToken value = Value; - if (value != null) - { - await value.WriteToAsync(writer, cancellationToken, converters).ConfigureAwait(false); - } - else - { - await writer.WriteNullAsync(cancellationToken).ConfigureAwait(false); - } + return value != null + ? value.WriteToAsync(writer, cancellationToken, converters) + : writer.WriteNullAsync(cancellationToken); } ///