예제 #1
0
        async Task <SearchResultMetadata> ReadMetadataAsync()
        {
            var metadata = new SearchResultMetadata();
            var reader   = this.response.XmlReader;

            for (;;)
            {
                await metadata.ReadXmlAsync(reader).ConfigureAwait(false);

                if (metadata.FieldNames.Count > 0)
                {
                    break;
                }

                Debug.Assert(reader.Name == "results" && (reader.IsEmptyElement ||
                                                          reader.NodeType == XmlNodeType.EndElement),
                             "Expected: <results/> or </results>");

                var isEmptyElement = reader.IsEmptyElement;
                var readerNodeType = reader.NodeType;
                await reader.ReadAsync().ConfigureAwait(false);

                if (isEmptyElement || readerNodeType == XmlNodeType.EndElement)
                {
                    break;
                }
            }

            return(metadata);
        }
예제 #2
0
        async Task <SearchResultMetadata> ReadMetadataAsync()
        {
            var metadata = new SearchResultMetadata();

            await metadata.ReadXmlAsync(this.response.XmlReader).ConfigureAwait(false);

            return(metadata);
        }