本文整理汇总了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);
}
});
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例8: DictDeserialize
public virtual void DictDeserialize(IDictionary<string, object> docu, Scenario scenario = Scenario.Database)
{
EncodingType = docu.Set("Encoding", EncodingType);
}
示例9: DictDeserialize
public virtual void DictDeserialize(IDictionary<string, object> dicts, Scenario scenario = Scenario.Database)
{
Name = dicts.Set("Name", Name);
}
示例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);
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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;
}
示例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);
}