示例#1
0
        public override void WriteObject(XmlWriter writer, object graph)
        {
            ArrayOfMeasurement ArrayOfMeasurementField = ((ArrayOfMeasurement)(graph));

            if (WriteParentElement(writer, true, true, graph))
            {
                MeasurementDataContractSerializer MeasurementDCS = new MeasurementDataContractSerializer("Measurement", "http://schemas.datacontract.org/2004/07/ClassLibrary3", "http://schemas.datacontract.org/2004/07/ClassLibrary3");
                for (int i = 0; (i < ArrayOfMeasurementField.Measurement.Length); i = (i + 1))
                {
                    MeasurementDCS.WriteObject(writer, ArrayOfMeasurementField.Measurement[i]);
                }
                writer.WriteEndElement();
            }
            return;
        }
示例#2
0
        public override object ReadObject(XmlReader reader)
        {
            ArrayOfMeasurement ArrayOfMeasurementField = null;

            if (IsParentStartElement(reader, false, true))
            {
                ArrayOfMeasurementField = new ArrayOfMeasurement();
                reader.Read();
                MeasurementDataContractSerializer MeasurementDCS   = new MeasurementDataContractSerializer("Measurement", "http://schemas.datacontract.org/2004/07/ClassLibrary3", "http://schemas.datacontract.org/2004/07/ClassLibrary3");
                System.Collections.ArrayList      Measurement_List = new System.Collections.ArrayList();
                for (int i = 0; (i > -1); i = (i + 1))
                {
                    if (!IsChildStartElement(reader, "Measurement", false, false))
                    {
                        ArrayOfMeasurementField.Measurement = new Measurement[Measurement_List.Count];
                        Measurement_List.CopyTo(ArrayOfMeasurementField.Measurement);
                        break;
                    }
                    Measurement_List.Add(((Measurement)(MeasurementDCS.ReadObject(reader))));
                }
                reader.ReadEndElement();
            }
            return(ArrayOfMeasurementField);
        }