public static DatapointUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new DatapointUnmarshaller();
            }

            return(instance);
        }
Beispiel #2
0
        public GetMetricStatisticsResult Unmarshall(XmlUnmarshallerContext context)
        {
            GetMetricStatisticsResult getMetricStatisticsResult = new GetMetricStatisticsResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Label", targetDepth))
                    {
                        getMetricStatisticsResult.Label = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Datapoints/member", targetDepth))
                    {
                        getMetricStatisticsResult.Datapoints.Add(DatapointUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(getMetricStatisticsResult);
                }
            }



            return(getMetricStatisticsResult);
        }