close

(1) [Serializable()] //Set this attribute to all the classes that you define to be serialized

    public class Serializeclass : ISerializable

(2)     Stream stream = File.Open("Serializeclass", FileMode.Create);

            BinaryFormatter bformatter = new BinaryFormatter();

            bformatter.Serialize(stream, sc);

            stream.Close();

(3) stream = File.Open("Serializeclass", FileMode.Open);

            bformatter = new BinaryFormatter();



 物件可以serialized自己,但是無法de-serialized自己(除非透過一個空殼子)



-----


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 questioner 的頭像
    questioner

    questioner

    questioner 發表在 痞客邦 留言(0) 人氣()