Welcome to mirror list, hosted at ThFree Co, Russian Federation.

IgnoreFormatter.cs « Formatters « MessagePack « src - github.com/aspnet/MessagePack-CSharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 036ec86de971e2f354ba38e969534c26d3841fa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System.Buffers;

namespace MessagePack.Formatters
{
    public sealed class IgnoreFormatter<T> : IMessagePackFormatter<T>
    {
        public void Serialize(IBufferWriter<byte> writer, T value, IFormatterResolver formatterResolver)
        {
            MessagePackBinary.WriteNil(writer);
        }

        public T Deserialize(ref ReadOnlySequence<byte> byteSequence, IFormatterResolver formatterResolver)
        {
            MessagePackBinary.ReadNextBlock(ref byteSequence);
            return default(T);
        }
    }
}