Exemplo n.º 1
0
        /// Format: IFormatter,BinaryFormatter
        /// Stream:FileStream
        /// formatter.Serialize(stream, s_object):序列化(文件流->文件object)
        /// <param name="s_object"></param>
        public static void SerializableObj(SerializableType type = SerializableType.Bin, SerializeObject s_object = null)
        {
            s_object     = s_object != null ? s_object : SerializeObject.DefualtSerializeObject;
            s_object.n1  = 1;
            s_object.num = 99;
            s_object.str = "一些字符串";
            switch (type)
            {
            case SerializableType.Bin:
                BinFormatHandler(s_object);
                break;

            case SerializableType.Soap:
                SoapFormatHandler(s_object);
                break;
            }
        }