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


C# IDictionary.Set方法代码示例

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


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

示例1: Invoke

        public Task Invoke(IDictionary<string, object> environment)
        {
            if (!environment.Get<string>(OwinConstants.RequestMethodKey).EqualsIgnoreCase("GET"))
            {
                return _inner(environment);
            }

            var originalOutput = environment.Get<Stream>(OwinConstants.ResponseBodyKey);
            var recordedStream = new MemoryStream();
            environment.Set(OwinConstants.ResponseBodyKey, recordedStream);

            return _inner(environment).ContinueWith(t => {
                recordedStream.Position = 0;
                environment[OwinConstants.ResponseBodyKey] = originalOutput;

                var response = new OwinHttpResponse(environment);

                if (IsGetHtmlRequest(environment) && response.StatusCode < 500)
                {
                    injectContent(environment, recordedStream, response);
                }
                else
                {
                    response.StreamContents(recordedStream);
                }
            });
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:27,代码来源:HtmlHeadInjectionMiddleware.cs

示例2: DictDeserialize

 public virtual void DictDeserialize(IDictionary<string, object> docu, Scenario scenario = Scenario.Database)
 {
     ProcessToDo.DictDeserialize(docu, scenario);
     Name = docu.Set("Name", Name);
     Description = docu.Set("Description", Description);
     CreateTime = docu.Set("CreateTime", CreateTime);
     ScriptPath = docu.Set("ScriptPath", ScriptPath);
 }
开发者ID:CHERRISHGRY,项目名称:Hawk,代码行数:8,代码来源:ProcessTask.cs

示例3: Evaluate

        public object Evaluate(IDictionary<string, object> context)
        {
            if (this.Expressions.Count == 0) return null;

            if (this.Expressions[0] is Variable)
            {
                var functionName = (this.Expressions[0] as Variable).Name;
                var func = context.Get(functionName) as IFunction;
                var rslt = func.Execute(context, this.Expressions.Skip(1).ToArray());
                context.Set("@", rslt);
                return rslt;
                /*Func<object> action = () => func.Execute(context, this.Expressions.Skip(1).ToArray());
                var task = new Task<object>(action);

                var handle = new ManualResetEvent(false);
                task.ContinueWith(x =>
                {
                    Console.WriteLine("setting wait handle");
                    handle.Set();
                    });

                EventLoop.Instance.Enqueue(task);
                Console.WriteLine("Awaiting wait handle");
                handle.WaitOne();
                Console.WriteLine("resuming wait handle");

                context.Set("@", task.Result);
                return task.Result;*/
            }

            // this is a number of lines of code
            object result = null;
            foreach (Statement statement in this.Expressions)
            {
                result = statement.Evaluate(context);
            }

            context.Set("@", result);

            return result;
        }
开发者ID:richorama,项目名称:RaLisp,代码行数:41,代码来源:Statement.cs

示例4: ParseValues

		public static void ParseValues(IDictionary<string, string> result, string header) {
			while (header.Length > 0) {
				var eq = header.IndexOf('=');
				if (eq < 0) eq = header.Length;
				var name = header.Substring(0, eq).Trim().Trim(new[] { ';', ',' }).Trim();

				var value = header = header.Substring(Math.Min(header.Length, eq + 1)).Trim();

				if (value.StartsWith("\"")) {
					ProcessValue(1, ref header, ref value, '"');
				} else if (value.StartsWith("'")) {
					ProcessValue(1, ref header, ref value, '\'');
				} else {
					ProcessValue(0, ref header, ref value, ' ', ',', ';');
				}

				result.Set(name, value);
			}
		}
开发者ID:mbithy,项目名称:aenetmail,代码行数:19,代码来源:HeaderValue.cs

示例5: LoadDecimalValidationAttributes

        private static void LoadDecimalValidationAttributes(IDictionary<string, object> attributes)
        {
            Throw.IfNullArgument(attributes, "attributes");

            var numberFormat = System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat;
            attributes.Set(DataCarcassValidation, "true");
            attributes.Set(DataNumberDecimalSeparator, numberFormat.CurrencyDecimalSeparator);
            attributes.Set(DataNumberGroupSeparator, numberFormat.CurrencyGroupSeparator);
        }
开发者ID:kamaelyoung,项目名称:Carcass,代码行数:9,代码来源:EditorTemplates.cs

示例6: DictDeserialize

 public override void DictDeserialize(IDictionary<string, object> docu, Scenario scenario = Scenario.Database)
 {
     base.DictDeserialize(docu, scenario);
     ContainHeader = docu.Set("ContainHeader", ContainHeader);
     SplitString = docu.Set("SplitString", SplitString);
 }
开发者ID:CHERRISHGRY,项目名称:Hawk,代码行数:6,代码来源:FileConnectorTable.cs

示例7: DictDeserialize

 public override void DictDeserialize(IDictionary<string, object> docu, Scenario scenario = Scenario.Database)
 {
     base.DictDeserialize(docu, scenario);
     Source.SelectItem = docu.Set("Source", Source.SelectItem);
     Target.SelectItem = docu.Set("Target", Target.SelectItem);
 }
开发者ID:GamesDesignArt,项目名称:Hawk,代码行数:6,代码来源:TransTF.cs

示例8: DictDeserialize

 public virtual void DictDeserialize(IDictionary<string, object> docu, Scenario scenario = Scenario.Database)
 {
     EncodingType = docu.Set("Encoding", EncodingType);
 }
开发者ID:CHERRISHGRY,项目名称:Hawk,代码行数:4,代码来源:FileConnector.cs

示例9: DictDeserialize

 public virtual void DictDeserialize(IDictionary<string, object> dicts, Scenario scenario = Scenario.Database)
 {
     Name = dicts.Set("Name", Name);
 }
开发者ID:GamesDesignArt,项目名称:Hawk,代码行数:4,代码来源:AbstractProcessMethod.cs

示例10: DictDeserialize

 public void DictDeserialize(IDictionary<string, object> docu, Scenario scenario = Scenario.Database)
 {
     URL = docu.Set("URL", URL);
     Allowautoredirect = docu.Set("Allowautoredirect", Allowautoredirect);
     Postdata = docu.Set("Postdata", Postdata);
     Encoding = docu.Set("Encoding", Encoding);
     Method = docu.Set("Method", Method);
     Parameters = docu.Set("Parameters", Parameters);
 }
开发者ID:GamesDesignArt,项目名称:Hawk,代码行数:9,代码来源:HttpItem.cs

示例11: Execute

 public object Execute(IDictionary<string, object> context, params object[] parameters)
 {
     var value = parameters[1].Evaluate(context);
     context.Set((parameters[0] as Variable).Name, value);
     return value;
 }
开发者ID:richorama,项目名称:RaLisp,代码行数:6,代码来源:Let.cs

示例12: DictDeserialize

 public override void DictDeserialize(IDictionary<string, object> dicts, Scenario scenario = Scenario.Database)
 {
     base.DictDeserialize(dicts, scenario);
     MaxThreadCount = dicts.Set("MaxThreadCount", MaxThreadCount);
     GenerateMode = dicts.Set("GenerateMode", GenerateMode);
     SampleMount = dicts.Set("SampleMount", SampleMount);
     var doc = dicts as FreeDocument;
     if (doc != null && doc.Children != null)
     {
         foreach (var child in doc.Children)
         {
             var name = child["Type"].ToString();
             var process = PluginProvider.GetObjectByType<IColumnProcess>(name);
             if (process != null)
             {
                 process.DictDeserialize(child);
                 CurrentETLTools.Add(process);
             }
         }
     }
 }
开发者ID:GamesDesignArt,项目名称:Hawk,代码行数:21,代码来源:SmartETLTool.cs

示例13: DictDeserialize

        public override void DictDeserialize(IDictionary<string, object> dicts, Scenario scenario = Scenario.Database)
        {
            base.DictDeserialize(dicts, scenario);
            URL = dicts.Set("URL", URL);
            RootXPath = dicts.Set("RootXPath", RootXPath);
            IsMultiData = dicts.Set("IsMultiData", IsMultiData);
            URLFilter = dicts.Set("URLFilter", URLFilter);
            Crawler = dicts.Set("Crawler", Crawler);
            ContentFilter = dicts.Set("ContentFilter", ContentFilter);
            if (dicts.ContainsKey("HttpSet"))
            {
                var doc2 = dicts["HttpSet"];
                var p = doc2 as IDictionary<string, object>;
                Http.UnsafeDictDeserialize(p);
            }

            if (dicts.ContainsKey("Login"))
            {
                var doc2 = dicts["Login"];
                var p = doc2 as IDictionary<string, object>;
                var item = new HttpItem();
                item.DictDeserialize(p);
                Documents.Add(item);
            }

            if (dicts.ContainsKey("Generator"))
            {
                var doc2 = dicts["Generator"];
                var p = doc2 as IDictionary<string, object>;
            }
            var doc = dicts as FreeDocument;
            if (doc?.Children != null)
            {
                foreach (var child in doc.Children)
                {
                    var item = new CrawlItem();
                    item.DictDeserialize(child);
                    CrawlItems.Add(item);
                }
            }
        }
开发者ID:CHERRISHGRY,项目名称:Hawk,代码行数:41,代码来源:SmartCrawler.cs

示例14: Execute

            public object Execute(IDictionary<string, object> context, params object[] parameters)
            {
                var newContext = new Dictionary<string, object>();
                foreach (var item in context)
                {
                    newContext.Add(item.Key, item.Value);
                }
                for (var i = 0; i < this.Args.Length; i++)
                {
                    newContext.Add(this.Args[i], parameters[i]);
                }

                if (this.Expressions.Length > 1)
                {
                    var output = (new Statement { Expressions = this.Expressions.ToList() }).Evaluate(newContext);
                    context.Set("@", output);
                    return output;
                }

                var output2 = this.Expressions[0].Evaluate(newContext);
                context.Set("@", output2);
                return output2;
            }
开发者ID:richorama,项目名称:RaLisp,代码行数:23,代码来源:Fn.cs

示例15: DictDeserialize

 public void DictDeserialize(IDictionary<string, object> docu, Scenario scenario = Scenario.Database)
 {
     Name = docu.Set("Name", Name);
     XPath = docu.Set("XPath", XPath);
     IsHTML = docu.Set("IsHtml", IsHTML);
 }
开发者ID:CHERRISHGRY,项目名称:Hawk,代码行数:6,代码来源:CrawlItem.cs


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