本文整理汇总了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;
}
}
示例2: IsJsonClass
public static bool IsJsonClass(Hash hash)
{
return hash.Count > 0 && hash.ContainsKey(_jsonClass);
}
示例3: GetEnv
private object GetEnv(Hash env, string key)
{
var rubyKey = RubyString(key);
return env.ContainsKey(rubyKey) ? env[rubyKey] : null;
}
示例4: RemoveEnv
private void RemoveEnv(Hash env, string key)
{
var rubyKey = RubyString(key);
if (env.ContainsKey(rubyKey)) env.Remove(rubyKey);
}
示例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;
}
}