i have a button in my form that is supposed to take a list and save it to binary file on click. i compile and run the program enter the valued in the text box and click the save button. i look in the project directory and there is no new file. did i code it wrong or miss something?
private void button1_Click(object sender, EventArgs e)
{
List<ore> oreData = new List<ore>();
oreData.Add(b1);
oreData.Add(b2);
FileStream fs = new FileStream("ore.dat", FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, oreData);
fs.Close();
}
Application.StartupPathas the prefix for file names.BinaryFormatteras a persistence format. It has some jagged edges that can really hurt you as you evolve your application. There are binary serializers that are far more suitable, IMO.