会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
去看更多
wangshijie
Welcome
我思故我在
博客园
首页
新随笔
联系
订阅
管理
linq 利用反射 获取主键
Code
Type t
=
typeof
(PUB_C_DEPARTMENT);
var a
=
from property
in
t.GetProperties()
from ColumnAttribute attribute
in
property.GetCustomAttributes(
typeof
(ColumnAttribute),
false
)
where
attribute.IsPrimaryKey
==
true
select
new
{ property
=
property, column
=
attribute }
var s
=
a.Select(p
=>
p.property.NameFirst();
posted @
2009-05-13 15:52
jeer
阅读(
439
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告