本文整理汇总了C#中JToken.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# JToken.ToArray方法的具体用法?C# JToken.ToArray怎么用?C# JToken.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JToken
的用法示例。
在下文中一共展示了JToken.ToArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProcessors
private List<IProcessor> GetProcessors(JToken jsonProcessors, JsonSerializer serializer)
{
var processors = new List<IProcessor>();
foreach (var jsonProcessor in jsonProcessors.ToArray())
{
var processorName = jsonProcessor.ToObject<JObject>().Properties().First().Name;
switch (processorName)
{
case "attachment":
processors.Add(jsonProcessor.ToObject<AttachmentProcessor>(serializer));
break;
case "append":
processors.Add(jsonProcessor.ToObject<AppendProcessor>(serializer));
break;
case "convert":
processors.Add(jsonProcessor.ToObject<ConvertProcessor>(serializer));
break;
case "date":
processors.Add(jsonProcessor.ToObject<DateProcessor>(serializer));
break;
case "date_index_name":
processors.Add(jsonProcessor.ToObject<DateIndexNameProcessor>(serializer));
break;
case "fail":
processors.Add(jsonProcessor.ToObject<FailProcessor>(serializer));
break;
case "foreach":
processors.Add(jsonProcessor.ToObject<ForeachProcessor>(serializer));
break;
case "geoip":
processors.Add(jsonProcessor.ToObject<GeoIpProcessor>(serializer));
break;
case "grok":
processors.Add(jsonProcessor.ToObject<GrokProcessor>(serializer));
break;
case "gsub":
processors.Add(jsonProcessor.ToObject<GsubProcessor>(serializer));
break;
case "join":
processors.Add(jsonProcessor.ToObject<JoinProcessor>(serializer));
break;
case "lowercase":
processors.Add(jsonProcessor.ToObject<LowercaseProcessor>(serializer));
break;
case "remove":
processors.Add(jsonProcessor.ToObject<RemoveProcessor>(serializer));
break;
case "rename":
processors.Add(jsonProcessor.ToObject<RenameProcessor>(serializer));
break;
case "set":
processors.Add(jsonProcessor.ToObject<SetProcessor>(serializer));
break;
case "sort":
processors.Add(jsonProcessor.ToObject<SortProcessor>(serializer));
break;
case "split":
processors.Add(jsonProcessor.ToObject<SplitProcessor>(serializer));
break;
case "trim":
processors.Add(jsonProcessor.ToObject<TrimProcessor>(serializer));
break;
case "uppercase":
processors.Add(jsonProcessor.ToObject<UppercaseProcessor>(serializer));
break;
default:
break;
}
}
return processors;
}