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

            return(instance);
        }
        public DescribeMetricCollectionTypesResult Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeMetricCollectionTypesResult describeMetricCollectionTypesResult = new DescribeMetricCollectionTypesResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Metrics/member", targetDepth))
                    {
                        describeMetricCollectionTypesResult.Metrics.Add(MetricCollectionTypeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Granularities/member", targetDepth))
                    {
                        describeMetricCollectionTypesResult.Granularities.Add(MetricGranularityTypeUnmarshaller.GetInstance().Unmarshall(context));

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



            return(describeMetricCollectionTypesResult);
        }