本文整理汇总了C#中System.Web.Script.Serialization.JavaScriptSerializer.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Script.Serialization.JavaScriptSerializer.Count方法的具体用法?C# Script.Serialization.JavaScriptSerializer.Count怎么用?C# Script.Serialization.JavaScriptSerializer.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Script.Serialization.JavaScriptSerializer
的用法示例。
在下文中一共展示了Script.Serialization.JavaScriptSerializer.Count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetData
private void GetData(ExternalServiceClient client)
{
InvokeOnFormThread(() =>
{
this.chart2.Series.Clear();
var timeseries = this.chart2.Series.Add("timeseries");
timeseries.XValueType = ChartValueType.Date;
textBox2.Text = "Working...";
label4.Text = "Working...";
});
string query = textBox1.Text;
//object[] parameters = new object[] { textBox1.Text };
//Expression<Func<Mention, object[], bool>> query = (x,p) => true;
//if (!string.IsNullOrWhiteSpace(textBox1.Text))
//{
// query = (x, p) => x.Name.Contains((string)p[0]) || x.Description.Contains((string)p[0]);
//}
//var query2 = EvoQLBuilder.GetLambda(textBox1.Text);
//Expression<Func<IEnumerable<ThriftMention>, IEnumerable<ThriftDatapoint>>> mapreduce = mentions =>
// from mention in mentions
// from tag in mention.Tags
// group mention by new { mention.OccurredOn.Year, mention.OccurredOn.Month, mention.OccurredOn.Day, TagId = tag } into g
// select new ThriftDatapoint { Count = g.Count(), EntityId = g.Key.TagId, Value = g.Average(x => x.Sentiment), Timestamp = new DateTime(g.Key.Year, g.Key.Month, g.Key.Day).Ticks };
//Expression<Func<IEnumerable<Mention>, IEnumerable<Datapoint>>> mapreduce1 = collection =>
// from mention in collection
// from tag in mention.Tags
// from datasource in mention.Datasources
// group mention by new MentionGroup{ Timestamp = mention.OccurredOnTicks, Id = tag, Id2 = datasource } into g
// select new Datapoint { EntityId = g.Key.Id, EntityId2 = g.Key.Id2, Timestamp = g.Key.Timestamp };
//Expression<Func<IEnumerable<Mention>, IEnumerable<Datapoint>>> mapreduce = collection =>
// collection.SelectMany(m => m.Tags, (m, t) => new MentionMetadata { Mention = m, Id = t }).SelectMany(x => x.Mention.Datasources, (md, ds) => new MentionMetadata2 { Child = md, Id = ds }).GroupBy(md => new MentionGroup { Timestamp = md.Child.Mention.OccurredOnTicks, Id = md.Child.Id, Id2 = md.Id }).Select(x => new Datapoint { Timestamp = x.Key.Timestamp, EntityId = x.Key.Id, EntityId2 = x.Key.Id2 });
//Expression<Func<IEnumerable<Mention>, IEnumerable<Datapoint>>> mapreduce = x => x.GroupBy(y => y.OccurredOnDayTicks).Select(g => new Datapoint { Count = g.Count(), Timestamp = g.Key });
//Expression<Func<IEnumerable<Mention>, IEnumerable<Datapoint>>> mapreduce = x => x.GroupBy(y => new MentionGroup{ Timestamp = y.OccurredOnTicks - (y.OccurredOnTicks % 864000000000) }).Select(g => new Datapoint { Count = g.Count(), Value = g.Average(y => y.Sentiment), Timestamp = g.Key.Timestamp });
//Expression<Func<IEnumerable<Mention>, IEnumerable<Datapoint>>> mapreduce = null; // ReduceExpressionGeneration.MakeExpression(null, SelectedSelect, SelectedGroupBy, SelectedGroupBy2);
//Expression<Func<IEnumerable<Datapoint>, double>> merge = x => x.Sum(y => y.Value);
//if (SelectedSelect == SelectTypes.Count) merge = x => x.Sum(y => (double)y.Count);
var mapreduce = textBox9.Text;
//Expression<Func<IEnumerable<Mention>, IEnumerable<Mention>>> paging = c => c.OrderByDescending(x => x.OccurredOnTicks).Take(25);
ExpressionSerializer serializer = new ExpressionSerializer();
//InvokeOnFormThread(() =>
//{
// //ExpressionSerializer serializer = new ExpressionSerializer();
// //textBox6.Text = serializer.Serialize(mapreduce).ToString();
//});
var domain = textBox3.Text;
//var minDate = dateTimePicker1.Value;
//var maxDate = dateTimePicker2.Value;
string command = textBox7.Text;
Stopwatch sw = new Stopwatch();
sw.Start();
var result = client.GetData(domain, "__ql__" + query, "__ql__" + mapreduce, "__default__", null, command);
sw.Stop();
result.Metadata.OperationTime = sw.Elapsed;
InvokeOnFormThread(() =>
{
var area = chart2.ChartAreas.First();
var oldseries = chart2.Series.ToArray();
string separator = "\r\n################################################################################################################################\r\n";
HardcodedBermudaDatapoint[] datapoints = new HardcodedBermudaDatapoint[0];
string jsonError = null;
if (result.Data != null)
{
try
{
datapoints = new JavaScriptSerializer().Deserialize<HardcodedBermudaDatapoint[]>(result.Data);
label4.Text = "Retrieved " + datapoints.Count() + "\r\nin " + sw.Elapsed;
}
catch (Exception ex)
{
jsonError = ex.ToString() + separator;
}
}
else
{
datapoints = new HardcodedBermudaDatapoint[0];
//.........这里部分代码省略.........