public static void WriteToFile(string Path, List<MenuItem> data, string Header) { videoCollection videos = new videoCollection(); videos.videos = data; videos.Header = Header; WriteToFile(Path, videos); }
public static void WriteToFile(string Path, videoCollection data) { BinaryFormatter formatter = new BinaryFormatter(); using (Stream fStream = new FileStream(Path, FileMode.Create, FileAccess.Write, FileShare.None)) { formatter.Serialize(fStream, data); } }