- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Xml.Linq;
- using System.Collections.Generic;
-
- public partial class Default3 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- List<Person> list = new List<Person> {
- new Person(){Id=1,Name="小明'\"}[]{><,\\/~、\r\n"},
- new Person(){Id=2,Name="小华"}
- };
-
- DataTable dt = new DataTable("MatrixInfo");
- DataColumn dc1 = new DataColumn("ID");
- DataColumn dc2 = new DataColumn("Name");
- dt.Columns.Add(dc1);
- dt.Columns.Add(dc2);
- foreach (Person p in list)
- {
- DataRow dr = dt.NewRow();
- dr["ID"] = p.Id;
- dr["Name"] = p.Name;
- dt.Rows.Add(dr);
- }
-
- DataTable dv = dt.DefaultView.ToTable(false, new string[] { "Name" });
- }
-
- public class Person
- {
- public int Id { get; set; }
- public string Name { get; set; }
- }
- }
posted @
2015-06-28 14:08
大林just
阅读(
467)
评论()
编辑
收藏
举报