Async JToken methods
This commit is contained in:
committed by
James Newton-King
parent
dde1d905df
commit
c9b2ec8055
@@ -204,6 +204,31 @@ namespace Newtonsoft.Json
|
||||
{
|
||||
return cancellationToken.CancelIfRequestedAsync<string>() ?? Task.FromResult(ReadAsString());
|
||||
}
|
||||
|
||||
internal async Task<bool> ReadAndMoveToContentAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return await ReadAsync(cancellationToken).ConfigureAwait(false) && await MoveToContentAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal async Task<bool> MoveToContentAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
switch (TokenType)
|
||||
{
|
||||
case JsonToken.None:
|
||||
case JsonToken.Comment:
|
||||
if (!await ReadAsync(cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user