示例#1
0
        //Method for Deserialize XML to Object
        private PatientDetails CreateXmlToObject(string XMLString)
        {
            string         Msg            = string.Empty;
            PatientDetails patientdetails = new PatientDetails();
            XmlSerializer  oXmlSerializer = new XmlSerializer(patientdetails.GetType());

            try
            {
                //The StringReader will be the stream holder for the existing XML file
                patientdetails = (PatientDetails)oXmlSerializer.Deserialize(new StringReader(XMLString));
                //initially deserialized, the data is represented by an object without a defined type
            }
            catch (Exception ex)
            {
                Msg = ex.Message;
            }

            return(patientdetails);
        }