Sergio0694 / BinaryPack

The fastest and most memory efficient binary serialization library for .NET Standard 2.1, powered by dynamic IL generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude fields in deserialization model

Severus1992 opened this issue · comments

Hello! Interested in the following question: is it possible to add the ability to exclude fields in the deserialization model? For example:
public class InputClass
{
public int Value1 { get; set; }
public Guid Value2 { get; set; }
public string Value3 { get; set; }
public decimal Value4 { get; set; }
public List Container { get; set; }

public class Container1
{
public long Name1 { get; set; }
public DateTime Name2 { get; set; }
public string Name3 { get; set; }
}
}

public class OutputClass
{
public Guid Value2 { get; set; }
public string Value3 { get; set; }
public decimal Value4 { get; set; }

public class Container2
{
public DateTime Name2 { get; set; }
public string Name3 { get; set; }
}
}

var testData = new InputClass { ...... };
var bytes= BinaryConverter.Serialize(testData);
var result = BinaryConverter.Deserialize(bytes);
Now, an exception occurs when deserializing.

  1. Is there a plan to add the following deserialization method?
    public static T Deserialize(Type type, byte[] array) where T : new();