コード例 #1
0
        static QueryDetails ReadQueryDetailsFromFile()
        {
            IFormatter   formatter    = new SoapFormatter();
            Stream       stream       = new FileStream(kQueryDetailsFilename, FileMode.Open, FileAccess.Read, FileShare.Read);
            QueryDetails queryDetails = (QueryDetails)formatter.Deserialize(stream);

            stream.Close();

            return(queryDetails);
        }
コード例 #2
0
        static bool WriteQueryDetailsToFile(String businessName, DateTime startDate, DateTime endDate)
        {
            var queryDetails = new QueryDetails();

            queryDetails.BusinessName = businessName;
            queryDetails.StartDate    = startDate;
            queryDetails.EndDate      = endDate;
            IFormatter formatter = new SoapFormatter();
            Stream     stream    = new FileStream(kQueryDetailsFilename, FileMode.Create, FileAccess.Write, FileShare.None);

            formatter.Serialize(stream, queryDetails);
            stream.Close();

            return(true);
        }