internal static QueryResultInfo GetSingleResultFromRequest(SegmentInfo segmentInfo) { Debug.Assert(segmentInfo != null && segmentInfo.RequestEnumerable != null, "segmentInfo != null && segmentInfo.RequestEnumerable != null"); var queryResults = new QueryResultInfo(segmentInfo.RequestEnumerable); try { WebUtil.CheckResourceExists(queryResults.MoveNext(), segmentInfo.Identifier); WebUtil.CheckNullDirectReference(queryResults.Current, segmentInfo); return(queryResults); } catch { // Dispose the Enumerator in case of error WebUtil.Dispose(queryResults); throw; } }