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


C# Hash.ContainsKey方法代码示例

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


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

示例1: Parser

        public Parser(RubyScope scope, MutableString source, Hash options)
        {
            InitializeLibrary(scope);

            _json = new ParserEngineState(this, scope, source);
            if (options.Count > 0) {
                if (options.ContainsKey(_maxNesting)) {
                    _json.MaxNesting = options[_maxNesting] is int ? (int)options[_maxNesting] : 0;
                }
                _json.AllowNaN = options.ContainsKey(_allowNan) ? (bool)options[_allowNan] : ParserEngineState.DEFAULT_ALLOW_NAN;
                // TODO: check needed, create_id could be TrueClass, FalseClass, NilClass or String
                _json.CreateID = options.ContainsKey(_createAdditions) && (bool)options[_createAdditions] ? Helpers.GetCreateId(scope) : null;
            }
        }
开发者ID:nrk,项目名称:ironruby-json,代码行数:14,代码来源:Parser.cs

示例2: IsJsonClass

 public static bool IsJsonClass(Hash hash)
 {
     return hash.Count > 0 && hash.ContainsKey(_jsonClass);
 }
开发者ID:nrk,项目名称:ironruby-json,代码行数:4,代码来源:Helpers.Parser.cs

示例3: GetEnv

 private object GetEnv(Hash env, string key)
 {
     var rubyKey = RubyString(key);
     return env.ContainsKey(rubyKey) ? env[rubyKey] : null;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:AspNet.cs

示例4: RemoveEnv

 private void RemoveEnv(Hash env, string key)
 {
     var rubyKey = RubyString(key);
     if (env.ContainsKey(rubyKey)) env.Remove(rubyKey);
 }
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:AspNet.cs

示例5: Configure

 public static void Configure(RubyContext/*!*/ context, GeneratorState/*!*/ self, Hash/*!*/ configuration)
 {
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "indent"))) {
         self.Indent = configuration[Helpers.GetGeneratorStateKey(context, "indent")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "space"))) {
         self.Space = configuration[Helpers.GetGeneratorStateKey(context, "space")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "space_before"))) {
         self.SpaceBefore = configuration[Helpers.GetGeneratorStateKey(context, "space_before")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "array_nl"))) {
         self.ArrayNl = configuration[Helpers.GetGeneratorStateKey(context, "array_nl")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "object_nl"))) {
         self.ObjectNl = configuration[Helpers.GetGeneratorStateKey(context, "object_nl")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "check_circular"))) {
         Object cc = configuration[Helpers.GetGeneratorStateKey(context, "check_circular")];
         self.CheckCircular = cc is bool ? (bool)cc : false;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "max_nesting"))) {
         Object mn = configuration[Helpers.GetGeneratorStateKey(context, "max_nesting")];
         self.MaxNesting = (mn is int) ? (int)mn : 0;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "allow_nan"))) {
         Object an = configuration[Helpers.GetGeneratorStateKey(context, "allow_nan")];
         self.AllowNaN = an is bool ? (bool)an : false;
     }
 }
开发者ID:nrk,项目名称:ironruby-json,代码行数:30,代码来源:GeneratorState.cs


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