A replacement for BinaryFormatter in .NET 8
In the old .NET Framework days, you could use the
BinaryFormatter class to serialize and deserialize objects. This can be convenient for cloning or storing some session states. As the
BinaryFormatter has some serious security concerns, the .NET team marked it as obsolete (as error) in .NET 7 and onwards.