public ActionResult Index()
{
var buildName = new List
效果如下:
step4:向buildName数组添加内容(数组形式)
代码:
public ActionResult Index()
{
int[] table = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
var buildName = new List();
var lineChart = new List();
var data = new List();
//向buildName中添加数组0,数组0内的元素为number类型
var p = from p1 in table
where p1 % 2 == 0
select p1;
buildName.Add(p);
//向buildName中添加数组1,数组1内的元素为Object类型
var q = from q1 in table
where q1 % 3 == 0
select new { id = q1 };
buildName.Add(q);
//向buildName中添加对象,对象的内同为数组1
buildName.Add(new {id=q});
data.Add(new
{
Buildname = buildName,
Linechart = lineChart
});
return Json(data, JsonRequestBehavior.AllowGet);
}
效果如下:
step5:向lineChart数组添加内容(数组形式)
①建立一个student类
class Student
{
public int id { get; set; }
public String name { get; set; }
}
②建立student容器,实例化并赋值
//建立student容器,并添加对象
List s = new List();
s.Add(new Student() { id = 1, name = "张三" });
s.Add(new Student() { id = 2, name = "李四" });
s.Add(new Student() { id = 3, name = "王五" });
③建立一个Employee类
class Employee
{
public int e_id { get; set; }
public String e_name { get; set; }
}
var info =
from w in s
join w1 in s1 on w.id equals w1.e_id
where w.id == 1 || w.id == 2
select new
{
id = w.id,
stu_name=w.name,
emp_name=w1.e_name
};
lineChart.Add(info);
完整代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace jsonTest1.Controllers
{
class Student
{
public int id { get; set; }
public String name { get; set; }
}
class Employee
{
public int e_id { get; set; }
public String e_name { get; set; }
}
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
int[] table = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
var buildName = new List();
var lineChart = new List();
var data = new List();
//向buildName中添加数组0,数组0内的元素为number类型
var p = from p1 in table
where p1 % 2 == 0
select p1;
buildName.Add(p);
//向buildName中添加数组1,数组1内的元素为Object类型
var q = from q1 in table
where q1 % 3 == 0
select new { id = q1 };
buildName.Add(q);
//向buildName中添加对象,对象的内同为数组1
buildName.Add(new {id=q});
//建立student容器,并添加对象
List s = new List();
s.Add(new Student() { id = 1, name = "张三" });
s.Add(new Student() { id = 2, name = "李四" });
s.Add(new Student() { id = 3, name = "王五" });
//建立Employee容器,并添加对象
List s1 = new List();
s1.Add(new Employee() { e_id = 1, e_name = "工_张三" });
s1.Add(new Employee() { e_id = 2, e_name = "工_李四" });
s1.Add(new Employee() { e_id = 3, e_name = "工_王五" });
//筛选信息,并将info添加至lineChart数组中
var info =
from w in s
join w1 in s1 on w.id equals w1.e_id
where w.id == 1 || w.id == 2
select new
{
id = w.id,
stu_name=w.name,
emp_name=w1.e_name
};
lineChart.Add(info);
data.Add(new
{
Buildname = buildName,
Linechart = lineChart
});
return Json(data, JsonRequestBehavior.AllowGet);
}
}
}
同生成的做法一样,添加和移除类成员只要去修改fields和methods中的元素即可。这里我们拿一个简单的类做例子,下面这个Task类,我们来移除isNeedRemove方法,并且添加一个int 类型的addedField属性。
package asm.core;
/**
* Created by yunshen.ljy on 2015/6/
交换两个数字的方法有以下三种 ,其中第一种最常用
/*
输出最小的一个数
*/
public class jiaohuan1 {
public static void main(String[] args) {
int a =4;
int b = 3;
if(a<b){
// 第一种交换方式
int tmep =
1. Kafka提供了两种Consumer API
High Level Consumer API
Low Level Consumer API(Kafka诡异的称之为Simple Consumer API,实际上非常复杂)
在选用哪种Consumer API时,首先要弄清楚这两种API的工作原理,能做什么不能做什么,能做的话怎么做的以及用的时候,有哪些可能的问题
CompositeChannelBuffer体现了Netty的“Transparent Zero Copy”
查看API(
http://docs.jboss.org/netty/3.2/api/org/jboss/netty/buffer/package-summary.html#package_description)
可以看到,所谓“Transparent Zero Copy”是通
// this need android:minSdkVersion="11"
getActionBar().setDisplayHomeAsUpEnabled(true);
@Override
public boolean onOptionsItemSelected(MenuItem item) {
$(document).ready(function () {
var request = {
QueryString :
function (val) {
var uri = window.location.search;
var re = new RegExp("" + val + "=([^&?]*)", &
ArticleSelect类在命名空间HoverTree.Model中可以认为是文章查询条件类,用于存放查询文章时的条件,例如HvtId就是文章的id。HvtIsShow就是文章的显示属性,当为-1是,该条件不产生作用,当为0时,查询不公开显示的文章,当为1时查询公开显示的文章。HvtIsHome则为是否在首页显示。HoverTree系统源码完全开放,开发环境为Visual Studio 2013
1. php 类
I found this class looking for something else actually but I remembered I needed some while ago something similar and I never found one. I'm sure it will help a lot of developers who try to
Design pattern for graph processing.
Since we consider a large number of graph-processing algorithms, our initial design goal is to decouple our implementations from the graph representation