RcBuilder@walla.com
call centre: 054-5614020

Binary Formatter

Posted by: RcBuilder  /   Category: bin / BinaryFormatter / Files / FileStream / Serialize / SOURCE CODE / Stream   /   No Comments
05
Oct
2014

Binary Formatter class Binary_Formatter { public void BaseObject(){ string Path = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "test.bin"); string Name = "Roby Cohen"; Console.WriteLine("SERIALIZE " + Name); BinaryFormatter formatter = new BinaryFormatter(); using (FileStream fsWrite = new FileStream(Path, FileMode.Create)) { formatter.Serialize(fsWrite, Name); } Console.WriteLine("DESERIALIZE "); using (FileStream fsRead = new FileStream(Path, System.IO.FileMode.Open)) { string WhatsMyName = (string)formatter.Deserialize(fsRead); Console.WriteLine(WhatsMyName); } } public void CustomObject() { string Path = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "test2.bin"); User user = new User(33, "Shirly Massa", "somewhere over the rainbow"); Console.WriteLine("SERIALIZE USER"); BinaryFormatter formatter.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים