演示PropertyCollection类的使用
来源:互联网 发布:矩阵室内设计 编辑:程序博客网 时间:2024/05/29 18:33
(摘录自《C#函数实用手册》冶金工业出版社)
代码:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
DataTable testDT = new DataTable("student");
DataColumn testDC = new DataColumn("Id", Type.GetType("System.Int32"));
testDT.Columns.Add(testDC);
testDC = new DataColumn("Name", Type.GetType("System.String"));
testDT.Columns.Add(testDC);
testDC = new DataColumn("School", Type.GetType("System.String"));
testDT.Columns.Add(testDC);
PropertyCollection testPC;
testPC = testDT.ExtendedProperties;
testPC.Add("Id", 1);
testPC.Add("name","ZeLi");
testPC.Add("edu", "Master");
Console.WriteLine("ID :" + testDT.ExtendedProperties["Id"]);
Console.WriteLine("名字:" + testDT.ExtendedProperties["name"]);
Console.WriteLine("学位:" + testDT.ExtendedProperties["edu"]);
Console.ReadLine();
}
}
}
*********************************
结果:
ID :1
名字:ZeLi
学位:Master
- 演示PropertyCollection类的使用
- 演示ConstraintCollection类的使用
- 演示DataRow类的使用
- 演示DataRowCollection类的使用
- 演示DataTable类的使用
- 演示DataTableCollection类的使用
- 演示DataView类的使用
- 演示ForeignKeyConstraint类的使用
- 演示UniqueConstraint类的使用
- 演示DataRow类的使用
- 演示ACE_Log_Msg类的使用
- 文件读入演示FileInputStream类的使用
- merge的使用演示
- 演示HashSet的使用
- CListCtrl 使用演示的例子
- 演示了指针的使用
- 演示简单标签的使用
- 演示简单标签的使用
- 演示DataTableCollection类的使用
- 通过函数调用得到n个要改变得值!
- 女性英文名[zz]
- 演示DataView类的使用
- 演示ForeignKeyConstraint类的使用
- 演示PropertyCollection类的使用
- 演示UniqueConstraint类的使用
- 孙鑫老师-快速掌握Java视频 下载 + 点评!
- 应用框架的设计与实现——.NET平台(4.3 SAF代码分析.源码2)
- ODBC Programmer Reference中文...
- String 、StringBuffer 和 StringBuilder
- 遇到问题后。。。
- 程序员创业三关
- 程序设计语言连载