Pārlūkot izejas kodu

Code cleanup.

master
savorboard pirms 3 gadiem
vecāks
revīzija
65e0d448b4
2 mainītis faili ar 5 papildinājumiem un 10 dzēšanām
  1. +1
    -1
      src/DotNetCore.CAP/OperateResult.cs
  2. +4
    -9
      src/DotNetCore.CAP/Serialization/ISerializer.JsonUtf8.cs

+ 1
- 1
src/DotNetCore.CAP/OperateResult.cs Parādīt failu

@@ -81,7 +81,7 @@ namespace DotNetCore.CAP
/// <summary>
/// Encapsulates an error from the operate subsystem.
/// </summary>
public class OperateError
public record struct OperateError
{
/// <summary>
/// Gets or sets ths code for this error.


+ 4
- 9
src/DotNetCore.CAP/Serialization/ISerializer.JsonUtf8.cs Parādīt failu

@@ -2,7 +2,6 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Buffers;
using System.Text.Json;
using System.Threading.Tasks;
using DotNetCore.CAP.Messages;
@@ -59,16 +58,12 @@ namespace DotNetCore.CAP.Serialization

public object Deserialize(object value, Type valueType)
{
if (value is JsonElement jToken)
if (value is JsonElement jsonElement)
{
var bufferWriter = new ArrayBufferWriter<byte>();
using (var writer = new Utf8JsonWriter(bufferWriter))
{
jToken.WriteTo(writer);
}
return JsonSerializer.Deserialize(bufferWriter.WrittenSpan, valueType, _jsonSerializerOptions);
return JsonSerializer.Deserialize(jsonElement, valueType, _jsonSerializerOptions);
}
throw new NotSupportedException("Type is not of type JToken");

throw new NotSupportedException("Type is not of type JsonElement");
}

public bool IsJsonType(object jsonObject)


Notiek ielāde…
Atcelt
Saglabāt