当前位置: 首页>>代码示例>>C#>>正文


C# Dictionary.GetString方法代码示例

本文整理汇总了C#中Dictionary.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.GetString方法的具体用法?C# Dictionary.GetString怎么用?C# Dictionary.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dictionary的用法示例。


在下文中一共展示了Dictionary.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeserializeSubAggregations

        internal static IEnumerable<IAggregation> DeserializeSubAggregations(Dictionary<string, object> aggDict)
        {
            Dictionary<string, object> subAggsDict = null;
            if (aggDict.ContainsKey(BucketAggregationBase._SUB_AGGREGATIONS))
            {
                subAggsDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(aggDict.GetString(_SUB_AGGREGATIONS));
            }
            else if (aggDict.ContainsKey(BucketAggregationBase._SUB_AGGREGATIONS_ABBR))
            {
                subAggsDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(aggDict.GetString(_SUB_AGGREGATIONS_ABBR));
            }
            else
                return null;

            List<IAggregation> subAggregations = new List<IAggregation>();

            AggregationTypeEnum aggType = AggregationTypeEnum.Average;
            foreach (KeyValuePair<string, object> aggKvp in subAggsDict)
            {
                Dictionary<string, object> aggTypeDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(aggKvp.Value.ToString());

                aggType = AggregationTypeEnum.Find(aggTypeDict.First().Key);
                if(aggType == null)
                    throw new Exception(aggTypeDict.First().Key + " is not a value aggregation type.");

                Dictionary<string, object> subAggDict = new Dictionary<string, object>();
                subAggDict.Add(aggKvp.Key, aggKvp.Value);

                string subAggJson = JsonConvert.SerializeObject(subAggDict);
                subAggregations.Add(JsonConvert.DeserializeObject(subAggJson, aggType.ImplementationType) as IAggregation);
            }

            return subAggregations;
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:34,代码来源:BucketAggregationBase.cs

示例2: DeserializeRangeBucket

        private IpRangeBucket DeserializeRangeBucket(Dictionary<string, object> bucketDict)
        {
            IpRangeBucket bucket = new IpRangeBucket();
            if (bucketDict.ContainsKey(_TO))
                bucket.To = bucketDict.GetString(_TO);
            if (bucketDict.ContainsKey(_FROM))
                bucket.From = bucketDict.GetString(_FROM);

            return bucket;
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:10,代码来源:IPv4RangeSerializer.cs

示例3: Deserialize

        internal static FieldDataFilter Deserialize(Dictionary<string, object> fieldDict)
        {
            if (fieldDict == null || !fieldDict.Any())
                return null;

            if (fieldDict.ContainsKey(_FREQUENCY))
            {
                return new FieldDataFilter(fieldDict.GetString(_REGEX_PATTERN), Frequency.Deserialize(JsonConvert.DeserializeObject<Dictionary<string, object>>(fieldDict.GetString(_FREQUENCY))));
            }

            return new FieldDataFilter(fieldDict.GetString(_REGEX_PATTERN));
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:12,代码来源:FieldDataFilter.cs

示例4: DeserializeFacetInfo

 internal static void DeserializeFacetInfo(FacetBase facet, Dictionary<string, object> facetDict)
 {
     if (facetDict.ContainsKey(_FACET_FILTER))
         facet.FacetFilter = JsonConvert.DeserializeObject<IFilter>(facetDict.GetString(_FACET_FILTER));
     facet.IsScopeGlobal = facetDict.GetBool(_GLOBAL, _GLOBAL_DEFAULT);
     facet.NestedObject = facetDict.GetStringOrDefault(_NESTED);
     facet.Size = facetDict.GetInt32(_SIZE, _SIZE_DEFAULT);
 }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:8,代码来源:FacetSerializer.cs

示例5: Deserialize

        internal static void Deserialize(DocumentPropertyBase prop, Dictionary<string, object> fieldDict)
        {
            if (!fieldDict.Any())
                return;

            MappingBase.Deserialize(prop, fieldDict);
            prop.IncludeInAll = fieldDict.GetBool(_INCLUDE_IN_ALL, _INCLUDE_IN_ALL_DEFAULT);
            prop.IndexName = fieldDict.GetStringOrDefault(_INDEX_NAME);
            prop.PropertyType = PropertyTypeEnum.Find(fieldDict.GetString(_TYPE, _PROPERTY_TYPE_DEFAULT.ToString()));
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:10,代码来源:DocumentPropertyBase.cs

示例6: Deserialize

        internal static void Deserialize(MappingBase mappingBase, Dictionary<string, object> fieldDict)
        {
            if (fieldDict == null || !fieldDict.Any())
                return;

            IndexSettingEnum indexSetting = IndexSettingEnum.No;
            mappingBase.Index = IndexSettingEnum.Find(fieldDict.GetString(_INDEX_KEY, mappingBase._INDEX_DEFAULT.ToString()));

            StoreSettingEnum storeSetting = StoreSettingEnum.No;
            mappingBase.Store = fieldDict.GetBool(_STORE_KEY, mappingBase._STORE_DEFAULT);
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:11,代码来源:MappingBase.cs

示例7: Deserialize

        internal static void Deserialize(AnalyzerBase analyzer, Dictionary<string, object> fieldDict)
        {
            if (fieldDict == null || !fieldDict.Any())
                return;

            analyzer.Version = fieldDict.GetDoubleOrNull(_VERSION);
            if (fieldDict.ContainsKey(_ALIASES))
            {
                analyzer.Aliases = JsonConvert.DeserializeObject<IEnumerable<string>>(fieldDict.GetString(_ALIASES));
            }
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:11,代码来源:AnalyzerBase.cs

示例8: Deserialize

        internal static Norms Deserialize(Dictionary<string, object> fieldDict, bool isAnalyzed = true)
        {
            if (fieldDict == null || !fieldDict.ContainsKey(_NORMS))
                return null;

            Norms norms = new Norms();
            Dictionary<string, object> normsDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(fieldDict.GetString(_NORMS));
            if (isAnalyzed)
                norms.IsEnabled = normsDict.GetBool(_IS_ENABLED, _IS_ENABLED_ANALYZED_DEFAULT);
            else
                norms.IsEnabled = normsDict.GetBool(_IS_ENABLED, _IS_ENABLED_NOT_ANALYZED_DEFAULT);

            norms.Loading = NormLoadingEnum.Find(normsDict.GetString(_LOADING, _LOADING_DEFAULT.ToString()));

            return norms;
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:16,代码来源:Norms.cs

示例9: Deserialize

        internal static DocumentMapping Deserialize(Dictionary<string, object> fieldDict)
        {
            DocumentMapping mapping = new DocumentMapping();
            if (fieldDict.ContainsKey(_ALL))
                mapping.All = JsonConvert.DeserializeObject<All>(fieldDict.GetString(_ALL));
            if (fieldDict.ContainsKey(_ANALYZER))
                mapping.Analyzer = JsonConvert.DeserializeObject<DocumentAnalyzer>(fieldDict.GetString(_ANALYZER));
            if (fieldDict.ContainsKey(_ID))
                mapping.Id = JsonConvert.DeserializeObject<DocumentIdentifier>(fieldDict.GetString(_ID));
            if (fieldDict.ContainsKey(_INDEX))
                mapping.Index = JsonConvert.DeserializeObject<DocumentIndex>(fieldDict.GetString(_INDEX));
            if (fieldDict.ContainsKey(_PARENT))
                mapping.Parent = JsonConvert.DeserializeObject<ParentType>(fieldDict.GetString(_PARENT));
            if (fieldDict.ContainsKey(_ROUTING))
                mapping.Routing = JsonConvert.DeserializeObject<DocumentRouting>(fieldDict.GetString(_ROUTING));
            if (fieldDict.ContainsKey(_SIZE))
                mapping.Size = JsonConvert.DeserializeObject<DocumentSize>(fieldDict.GetString(_SIZE));
            if (fieldDict.ContainsKey(_SOURCE))
                mapping.Source = JsonConvert.DeserializeObject<DocumentSource>(fieldDict.GetString(_SOURCE));
            if (fieldDict.ContainsKey(_TIME_TO_LIVE))
                mapping.TimeToLive = JsonConvert.DeserializeObject<DocumentTimeToLive>(fieldDict.GetString(_TIME_TO_LIVE));
            if (fieldDict.ContainsKey(_TIMESTAMP))
                mapping.Timestamp = JsonConvert.DeserializeObject<DocumentTimestamp>(fieldDict.GetString(_TIMESTAMP));
            if (fieldDict.ContainsKey(_TYPE))
                mapping.Type = JsonConvert.DeserializeObject<DocumentType>(fieldDict.GetString(_TYPE));

            return mapping;
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:28,代码来源:DocumentMapping.cs

示例10: Deserialize

        internal static void Deserialize(ObjectProperty prop, Dictionary<string, object> fieldDict)
        {
            if (fieldDict == null || !fieldDict.Any())
                return;

            if (fieldDict.ContainsKey(_COPY_TO))
            {
                try
                {
                    prop.CopyTo = JsonConvert.DeserializeObject<IEnumerable<string>>(fieldDict.GetString(_COPY_TO));
                }
                catch
                {
                    prop.CopyTo = new List<string>() { fieldDict.GetString(_COPY_TO) };
                }
            }

            prop.Dynamic = DynamicSettingEnum.Find(fieldDict.GetString(_DYNAMIC, _DYNAMIC_DEFAULT.ToString()));
            prop.IncludeInAll = fieldDict.GetBool(_INCLUDE_IN_ALL, _INCLUDE_IN_ALL_DEFAULT);
            prop.IsEnabled = fieldDict.GetBool(_IS_ENABLED, _IS_ENABLED_DEFAULT);

            if (fieldDict.ContainsKey(_PROPERTIES))
            {
                prop.Properties = JsonConvert.DeserializeObject<DocumentPropertyCollection>(fieldDict.GetString(_PROPERTIES));
            }
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:26,代码来源:ObjectProperty.cs

示例11: RetrieveBox

        private GeoBoundingBoxFilter RetrieveBox(string fieldName, Dictionary<string, object> boxDict)
        {
            // maybe are are dealing with the vertices
            if (boxDict.Count() == 4)
                return GetBoxFromVertices(fieldName, boxDict);

            CoordinatePoint topLeft;
            CoordinatePoint bottomRight;
            if (boxDict.ContainsKey(_TOP_LEFT))
            {
                topLeft = CoordinatePointSerializer.DeserializeCoordinatePoint(boxDict.GetString(_TOP_LEFT));
                bottomRight = CoordinatePointSerializer.DeserializeCoordinatePoint(boxDict.GetString(_BOTTOM_RIGHT));
            }
            else if (boxDict.ContainsKey(_TOP_RIGHT))
            {
                CoordinatePoint topRight = CoordinatePointSerializer.DeserializeCoordinatePoint(boxDict.GetString(_TOP_RIGHT));
                CoordinatePoint bottomLeft = CoordinatePointSerializer.DeserializeCoordinatePoint(boxDict.GetString(_BOTTOM_LEFT));

                topLeft = new CoordinatePoint(topRight.Latitude, bottomLeft.Longitude);
                bottomRight = new CoordinatePoint(bottomLeft.Latitude, topRight.Longitude);
            }
            else
            {
                throw new Exception("No bounding box formed by current properties.");
            }

            return new GeoBoundingBoxFilter(fieldName, topLeft, bottomRight);
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:28,代码来源:GeoBoundingBoxSerializer.cs

示例12: ReadFieldsDict

 private void ReadFieldsDict(Dictionary<string, object> fieldsDict, MatchQueryBase matchQuery)
 {
     matchQuery.Analyzer = fieldsDict.GetStringOrDefault(_ANALYZER);
     matchQuery.CutOffFrequency = fieldsDict.GetDouble(_CUTOFF_FREQUENCY, _CUTOFF_FREQUENCY_DEFAULT);
     matchQuery.Fuzziness = fieldsDict.GetDouble(_FUZZINESS, _FUZZINESS_DEFAULT);
     matchQuery.IsLenient = fieldsDict.GetBool(_LENIENT, _LENIENT_DEFAULT);
     matchQuery.MaximumExpansions = fieldsDict.GetInt32OrNull(_MAX_EXPANSIONS);
     matchQuery.MinimumShouldMatch = fieldsDict.GetInt32(_MINIMUM_SHOULD_MATCH, _MINIMUM_SHOULD_MATCH_DEFAULT);
     matchQuery.Operator = OperatorEnum.Find(fieldsDict.GetString(_OPERATOR, _OPERATOR_DEFAULT.ToString()));
     matchQuery.PrefixLength = fieldsDict.GetInt32(_PREFIX_LENGTH, _PREFIX_LENGTH_DEFAULT);
     matchQuery.RewriteMethod = RewriteMethodsEnum.Find(fieldsDict.GetString(_REWRITE, "not a real object"));
     matchQuery.ZeroTerm = ZeroTermsEnum.Find(fieldsDict.GetString(_ZERO_TERMS_QUERY, _ZERO_TERMS_QUERY_DEFAULT.ToString()));
     matchQuery.QueryName = fieldsDict.GetStringOrDefault(QuerySerializer._QUERY_NAME);
 }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:14,代码来源:MatchSerializer.cs

示例13: Deserialize

        internal static void Deserialize(FieldProperty field, Dictionary<string, object> fieldDict)
        {
            MappingBase.Deserialize(field, fieldDict);
            field.IncludeInAll = fieldDict.GetBool(_INCLUDE_IN_ALL, _INCLUDE_IN_ALL_DEFAULT);
            field.Boost = fieldDict.GetDouble(_BOOST, _BOOST_DEFAULT);

            if (fieldDict.ContainsKey(_COPY_TO))
            {
                try 
                {
                    field.CopyTo = JsonConvert.DeserializeObject<IEnumerable<string>>(fieldDict.GetString(_COPY_TO));
                }
                catch
                {
                    field.CopyTo = new List<string>(){ fieldDict.GetString(_COPY_TO) };
                }
            }

            field.DocValuesFormat = DocValuesFormatEnum.Find(fieldDict.GetString(_DOC_VALUES_FORMAT, _DOC_VALUES_FORMAT_DEFAULT.ToString()));

            if(fieldDict.ContainsKey(_FIELD_DATA))
            {
                field.FieldData = FieldDataFilter.Deserialize(JsonConvert.DeserializeObject<Dictionary<string, object>>(fieldDict.GetString(_FIELD_DATA)));
            }
            
            if(fieldDict.ContainsKey(_FIELDS))
            {
                field.Fields = JsonConvert.DeserializeObject<DocumentPropertyCollection>(fieldDict.GetString(_FIELDS));
            }

            field.IndexName = fieldDict.GetString(_INDEX_NAME, field.Name);
            if(fieldDict.ContainsKey(_NULL_VALUE))
                field.NullValue = fieldDict[_NULL_VALUE];

            field.PostingsFormat = PostingFormatEnum.Find(fieldDict.GetString(_POSTINGS_FORMAT, _POSTINGS_FORMAT_DEFAULT.ToString()));
            field.Similarity = SimilarityAlgorithmEnum.Find(fieldDict.GetString(_SIMILARITY, _SIMILARITY_DEFAULT.ToString()));
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:37,代码来源:FieldProperty.cs

示例14: DeserializeHighlighterOptions

        internal static void DeserializeHighlighterOptions(HighlighterOptions options, Dictionary<string, object> fieldDict)
        {
            if(fieldDict == null || !fieldDict.Any())
                return;

            options.BoundaryCharacters = fieldDict.GetString(_BOUNDARY_CHARACTERS, _BOUNDARY_CHARACTERS_DEFAULT);
            options.BoundaryMaximumScan = fieldDict.GetInt32(_BOUNDARY_MAXIMUM_SCAN, _BOUNDARY_MAXIMUM_SCAN_DEFAULT);
            options.Encoder = EncoderTypeEnum.Find(fieldDict.GetString(_ENCODER, _ENCODER_DEFAULT.ToString()));
            options.FragmentSize = fieldDict.GetInt32(_FRAGMENT_SIZE, _FRAGMENT_SIZE_DEFAULT);
            options.NoMatchSize = fieldDict.GetInt32(_NO_MATCH_SIZE, _NO_MATCH_SIZE_DEFAULT);
            options.NumberOfFragments = fieldDict.GetInt32(_NUMBER_OF_FRAGMENTS, _NUMBER_OF_FRAGMENTS_DEFAULT);
            options.PhraseLimit = fieldDict.GetInt32(_PHRASE_LIMIT, _PHRASE_LIMIT_DEFAULT);
            if(fieldDict.ContainsKey(_POST_TAGS))
                options.PostTags = JsonConvert.DeserializeObject<IEnumerable<string>>(fieldDict.GetString(_POST_TAGS));
            if(fieldDict.ContainsKey(_PRE_TAGS))
                options.PreTags = JsonConvert.DeserializeObject<IEnumerable<string>>(fieldDict.GetString(_PRE_TAGS));
            options.RequireFieldMatch = fieldDict.GetBool(_REQUIRE_FIELD_MATCH, _REQUIRE_FIELD_MATCH_DEFAULT);
            options.TagsSchema = TagsSchemaEnum.Find(fieldDict.GetString(_TAGS_SCHEMA, _TAGS_SCHEMA_DEFAULT.ToString()));
            options.Type = HighlighterTypeEnum.Find(fieldDict.GetString(_HIGHLIGHTER_TYPE, _HIGHLIGHTER_TYPE_DEFAULT.ToString()));
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:20,代码来源:HighlighterSerializer.cs

示例15: Deserialize

        internal static PropertyAnalyzer Deserialize(Dictionary<string, object> fieldDict)
        {
            if (fieldDict == null || !fieldDict.Any())
                return null;

            PropertyAnalyzer propertyAnalyzer = null;
            if (fieldDict.ContainsKey(_ANALYZER))
            {
                propertyAnalyzer = new PropertyAnalyzer(GetAnalyzer(fieldDict.GetString(_ANALYZER)));
            }
            else if (fieldDict.ContainsKey(_INDEX_ANALYZER))
            {
                IAnalyzer searchAnalyzer = null;
                try 
                { 
                    searchAnalyzer = GetAnalyzer(fieldDict.GetStringOrDefault(_SEARCH_ANALYZER));
                }
                catch{}

                propertyAnalyzer = new PropertyAnalyzer(
                    GetAnalyzer(fieldDict.GetString(_INDEX_ANALYZER)),
                    searchAnalyzer);
            }

            return propertyAnalyzer;
        }
开发者ID:kbolay,项目名称:Bolay.Elastic,代码行数:26,代码来源:PropertyAnalyzer.cs


注:本文中的Dictionary.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。