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


C# Hash.Add方法代码示例

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


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

示例1: writeLogMessage

 public void writeLogMessage(String strMsg)
 {
     IDictionary<object, object> map = new Dictionary<object, object>();
     Hash values = new Hash(map);
     values.Add(CRhoRuby.CreateSymbol("url"), MutableString.Create(m_addrHost));
     values.Add(CRhoRuby.CreateSymbol("body"), MutableString.Create(strMsg));
     RhoParams p = new RhoParams(values);
     m_aHttp.addHttpCommand(new CAsyncHttp.HttpCommand("POST", p));
 }
开发者ID:nhinze,项目名称:rhodes,代码行数:9,代码来源:RhoLogServerSink.cs

示例2: GetAliases

        public static Hash GetAliases(RubyClass/*!*/ self)
        {
            var context = self.Context;
            var result = new Hash(context.EqualityComparer, RubyEncoding.Aliases.Count + 3);
            foreach (var alias in RubyEncoding.Aliases) {
                result.Add(MutableString.CreateAscii(alias.Key).Freeze(), MutableString.CreateAscii(alias.Value).Freeze());
            }

            result.Add(MutableString.CreateAscii("locale").Freeze(), MutableString.Create(context.RubyOptions.LocaleEncoding.Name).Freeze());
            result.Add(MutableString.CreateAscii("external").Freeze(), MutableString.Create(context.DefaultExternalEncoding.Name).Freeze());
            result.Add(MutableString.CreateAscii("filesystem").Freeze(), MutableString.Create(context.GetPathEncoding().Name).Freeze());
            return result;
        }
开发者ID:TerabyteX,项目名称:main,代码行数:13,代码来源:RubyEncodingOps.cs

示例3: AppendToHash

        public void AppendToHash(Hash imageParams)
        {
            if (Width != -1)
            {
                imageParams.Add("imageWidth", Width.ToString(CultureInfo.InvariantCulture));
            }

            if (Height != -1)
            {
                imageParams.Add("imageHeight", Height.ToString(CultureInfo.InvariantCulture));
            }

            if (Align != AlignOption.None)
            {
                imageParams.Add("imageAlign", GetAlignString(Align));
            }
        }
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:17,代码来源:ImageOptions.cs

示例4: Render

        public Task Render(IResponse response, ViewData data)
        {
            var register = new Hash();
            register.Add(DotLiquidFileSystem.Guid, _resolver);

            var hash = new Hash();
            hash.Add("Data", data.Data);
            hash.Add("Model", data.Model);
            hash.Add("Status", data.Status);
            var ctx = new Context(new List<Hash>(), hash, register, true);

            using (var writer = response.GetStreamWriter()) {
                _template.Render(writer, new RenderParameters {
                    Context = ctx
                });
            }
            return Task.FromResult(0);
        }
开发者ID:jammycakes,项目名称:dolstagis.web,代码行数:18,代码来源:DotLiquidView.cs

示例5: List

 public static Hash/*!*/ List(RubyContext/*!*/ context, RubyModule/*!*/ self) {
     Hash result = new Hash(context);
     result.Add(MutableString.Create("TERM"), ScriptingRuntimeHelpers.Int32ToObject(15));
     result.Add(MutableString.Create("SEGV"), ScriptingRuntimeHelpers.Int32ToObject(11));
     result.Add(MutableString.Create("KILL"), ScriptingRuntimeHelpers.Int32ToObject(9));
     result.Add(MutableString.Create("EXIT"), ScriptingRuntimeHelpers.Int32ToObject(0));
     result.Add(MutableString.Create("INT"), ScriptingRuntimeHelpers.Int32ToObject(2));
     result.Add(MutableString.Create("FPE"), ScriptingRuntimeHelpers.Int32ToObject(8));
     result.Add(MutableString.Create("ABRT"), ScriptingRuntimeHelpers.Int32ToObject(22));
     result.Add(MutableString.Create("ILL"), ScriptingRuntimeHelpers.Int32ToObject(4));
     return result;
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:12,代码来源:Signal.cs

示例6: FromStrictDictionary

        public static Hash FromStrictDictionary(this IDictionary<string, object> dictionary)
        {
            Hash result = new Hash();

            //Hash result = new Hash((h, k) => { throw new Exception("Unknown variable '" + k + "'"); }); // Removed for now since it make "includes" not working

            foreach (var keyValue in dictionary)
                result.Add(keyValue);

            return result;
        }
开发者ID:SolidQIT,项目名称:ABI-Compiler,代码行数:11,代码来源:DotLiquidHelper.cs

示例7: Render

        public override void Render(Context context, TextWriter result)
        {
            var template = Templates.GetCached(_templatePath);

            var parameters = new Hash();

            foreach (var assignment in _assignmentMap)
            {
                parameters.Add(assignment.Key, context[assignment.Value]);
            }

            result.Write(template.Render(parameters));
        }
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:13,代码来源:Templates.cs

示例8: CreateDefaultTagMapping

        private static Hash CreateDefaultTagMapping(RubyContext/*!*/ context) {
            Hash taggedClasses = new Hash(context.EqualityComparer);
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:array"), context.GetClass(typeof(RubyArray)));
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:exception"), context.GetClass(typeof(Exception)));
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:hash"), context.GetClass(typeof(Hash)));
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:object"), context.GetClass(typeof(object)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.RubyRange), context.GetClass(typeof(Range)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.RubyRegexp), context.GetClass(typeof(RubyRegex)));
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:string"), context.GetClass(typeof(MutableString)));
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:struct"), context.GetClass(typeof(RubyStruct)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.RubySymbol), context.GetClass(typeof(RubySymbol)));
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:symbol"), context.GetClass(typeof(RubySymbol)));
            taggedClasses.Add(MutableString.CreateAscii("tag:ruby.yaml.org,2002:time"), context.GetClass(typeof(RubyTime)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.Binary), context.GetClass(typeof(MutableString)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.Float), context.GetClass(typeof(Double)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.Int), context.GetClass(typeof(Integer)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.Map), context.GetClass(typeof(Hash)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.Seq), context.GetClass(typeof(RubyArray)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.Str), context.GetClass(typeof(MutableString)));
            taggedClasses.Add(MutableString.CreateAscii(Tags.Timestamp), context.GetClass(typeof(RubyTime)));
                                                 
            taggedClasses.Add(MutableString.CreateAscii(Tags.False), context.FalseClass);
            taggedClasses.Add(MutableString.CreateAscii(Tags.True), context.TrueClass);
            taggedClasses.Add(MutableString.CreateAscii(Tags.Null), context.NilClass);

            //if (ctor.GlobalScope.Context.TryGetModule(ctor.GlobalScope, "Date", out module)) {
            //    taggedClasses.Add(MutableString.CreateAscii(Tags.TimestampYmd), context.NilClass);
            //}

            //taggedClasses.Add(MutableString.CreateAscii("tag:yaml.org,2002:timestamp#ymd'"), );
            //Currently not supported             
            //taggedClasses.Add(MutableString.CreateAscii("tag:yaml.org,2002:omap"), ec.GetClass(typeof()));
            //taggedClasses.Add(MutableString.CreateAscii("tag:yaml.org,2002:pairs"),//    ec.GetClass(typeof()));
            //taggedClasses.Add(MutableString.CreateAscii("tag:yaml.org,2002:set"),//    ec.GetClass(typeof()));
            return taggedClasses;
        }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:36,代码来源:RubyYaml.cs

示例9: Request

        public Request(HttpRequestBase request) {
            ContractUtils.RequiresNotNull(request, "request");

            // http or https
            this.scheme = request.Url.Scheme;

            // move headers to a Ruby Hash
            this.headers = new Hash(RubyEngine.Context);
            foreach (string key in request.Headers.AllKeys) {
                string value = request.Headers.Get(key);
                if (string.IsNullOrEmpty(value)) continue;
                headers.Add(key, value);
            }

            this.queryString = request.QueryString.ToString();

            this.body = new RubyIO(RubyEngine.Context, request.InputStream, IOMode.ReadOnly);

            // Save the origional request incase it's needed.
            OrigionalRequest = request;
        }
开发者ID:BenHall,项目名称:ironruby,代码行数:21,代码来源:Request.cs

示例10: Check

        private static bool Check(string str1, string str2, int length)
        {
            var hash1 = new Hash(str1.Substring(0, length));

              var hashes1 = new HashSet<ulong>();
              var hashes2 = new HashSet<ulong>();

              hashes1.Add(hash1.Value1);
              hashes2.Add(hash1.Value2);

              for (int i = 0; i < str1.Length - length; i++)
              {
            hash1.Add(str1[length + i]);
            hash1.Remove(str1[i], length);

            hashes1.Add(hash1.Value1);
            hashes2.Add(hash1.Value2);
              }

              var hash2 = new Hash(str2.Substring(0, length));
              if (hashes1.Contains(hash2.Value1) &&
              hashes2.Contains(hash2.Value2))
              {
            return true;
              }

              for (int i = 0; i < str2.Length - length; i++)
              {
            hash2.Add(str2[length + i]);
            hash2.Remove(str2[i], length);

            if (hashes1.Contains(hash2.Value1) &&
             hashes2.Contains(hash2.Value2))
            {
              return true;
            }
              }

              return false;
        }
开发者ID:TelerikAcademy,项目名称:Data-Structures-and-Algorithms,代码行数:40,代码来源:Program.cs

示例11: ToHash

 public static Hash/*!*/ ToHash(RubyContext/*!*/ context, object/*!*/ self) {
     PlatformAdaptationLayer pal = context.DomainManager.Platform;
     Hash result = new Hash(context);
     foreach (DictionaryEntry entry in pal.GetEnvironmentVariables()) {
         result.Add(MutableString.Create(entry.Key.ToString()).Freeze(), MutableString.Create(entry.Value.ToString()).Freeze());
     }
     return result;
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:8,代码来源:EnvironmentSingletonOps.cs

示例12: CreateContextHash

        private Hash CreateContextHash()
        {
            var context = new Hash();

            context.Add("IsNonDynamicHTMLOutput", nonDynamicHTMLOutput);
            AddPublishingParameters(context);

            return context;
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:9,代码来源:Templates.cs

示例13: Execute

            public static RubyArray Execute(RhoDatabase/*!*/ self, MutableString/*!*/ sqlStatement, Boolean isBatch, RubyArray args)
            {
                try
                {
                    RubyArray retArr = new RubyArray();

                    if (isBatch)
                    {
                        self.m_db.executeBatchSQL(sqlStatement.ToString());
                    }
                    else
                    {
                        Object[] values = null;
                        if (args != null && args.Count > 0)
                        {
                            if (args[0] != null && args[0] is RubyArray)
                                values = ((RubyArray)args[0]).ToArray();
                            else
                                values = args.ToArray();
                        }

                        try
                        {
                            self.m_db.Lock();
                            using (IDBResult rows = self.m_db.executeSQL(sqlStatement.ToString(), values, true))
                            {
                                if (rows != null)
                                {
                                    MutableString[] colNames = null;
                                    for (; !rows.isEnd(); rows.next())
                                    {
                                        IDictionary<object, object> map = new Dictionary<object, object>();
                                        Hash row = new Hash(map);
                                        for (int nCol = 0; nCol < rows.getColCount(); nCol++)
                                        {
                                            if (colNames == null)
                                                colNames = getOrigColNames(rows);

                                            row.Add(colNames[nCol], rows.getRubyValueByIdx(nCol));
                                        }
                                        retArr.Add(row);
                                    }
                                }
                            }
                        }
                        finally
                        {
                            self.m_db.Unlock();
                        }
                    }

                    return retArr;
                }catch (Exception exc)
                {
                    //TODO: throw ruby exception
                    throw exc;
                }
            }
开发者ID:Chanic,项目名称:rhodes,代码行数:58,代码来源:RhoDatabase.cs

示例14: Render

        public string Render(Hash hash)
        {
            var renderParams = new RenderParameters();
            TextWriter textWriter = new StringWriter();

            hash.Add("Context", CreateContextHash());

            renderParams.LocalVariables = hash;
            renderParams.RethrowErrors = true;

            ParsedTemplate.Render(textWriter, renderParams);

            textWriter.Flush();

            return textWriter.ToString().Trim();
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:16,代码来源:Templates.cs

示例15: AddPublishingParameters

        private void AddPublishingParameters(Hash hash)
        {
            var publishingHash = new Hash();

            foreach(var publishFlag in publishFlags)
            {
                publishingHash.Add(publishFlag.Substring(0, 1).ToUpper() + publishFlag.Substring(1).ToLower(), true);
            }

            hash.Add("PublishingFor", publishingHash);
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:11,代码来源:Templates.cs


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