コード例 #1
0
        internal SearchServiceStatistics(SearchServiceCounters counters, SearchServiceLimits limits)
        {
            if (counters == null)
            {
                throw new ArgumentNullException(nameof(counters));
            }
            if (limits == null)
            {
                throw new ArgumentNullException(nameof(limits));
            }

            Counters = counters;
            Limits   = limits;
        }
        internal static SearchServiceStatistics DeserializeSearchServiceStatistics(JsonElement element)
        {
            SearchServiceCounters counters = default;
            SearchServiceLimits   limits   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("counters"))
                {
                    counters = SearchServiceCounters.DeserializeSearchServiceCounters(property.Value);
                    continue;
                }
                if (property.NameEquals("limits"))
                {
                    limits = SearchServiceLimits.DeserializeSearchServiceLimits(property.Value);
                    continue;
                }
            }
            return(new SearchServiceStatistics(counters, limits));
        }