<PackageReference Include="System.Runtime.Serialization.Formatters" Version="11.0.0-rc.2.26504.105" />

System.Runtime.Serialization.ISerializationSurrogate

public interface ISerializationSurrogate
Implements a serialization surrogate selector that allows one object to perform serialization and deserialization of another.
void GetObjectData(object obj, SerializationInfo info, StreamingContext context)

Populates the provided SerializationInfo with the data needed to serialize the object.

object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)

Populates the object using the information in the SerializationInfo.