public static void SaveProfileToFile(SaveProfile save) { string saveLocation = SaveLocation(); saveLocation += "profile.data"; IFormatter formatter = new BinaryFormatter(); using (Stream stream = new FileStream(saveLocation, FileMode.Create, FileAccess.Write, FileShare.None)) { formatter.Serialize(stream, save); } }