I have created a serialization object (for example student) in C# and I saved it as a binary file in this way:
public static void WriteToBinaryFile<T>(string filePath, T objectToWrite,
bool append = false)
{
using (Stream stream = File.Open(filePath, append ? FileMode.Append :
FileMode.Create))
{
var binaryFormatter = new
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
binaryFormatter.Serialize(stream, objectToWrite);
}
}
So now I want to change the name of the student and save the edited student object, but I do not want to delete the previous file and replace the new edited file instead of previous, but I just want to apply the changes in the original file.
It's like I want to change the name of a person, but not by killing him! and creating a person similar to the original person but with a new name.