由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to use reflection in C# to do this job?
相关主题
newbie python question请问Linux底下有没有最简易的show 2D x-y curve的工具
一个C++的概念问题用那个design pattern好?
问一个排序的问题关于inserter
intel icc hash_map 求救!binary_search只要求forward_iterator?
STL感觉实在太变态了deque的pointer和reference是怎么回事?
[菜鸟问题]类模板问题a question about std::stack
c++ iterator 弱问呼唤大侠们,我实在不能实现C++泛型的精神。
c++ template question:stl 的 member type 看起来挺头大的
相关话题的讨论汇总
话题: class话题: c#话题: attributes话题: job话题: reflection
进入Programming版参与讨论
1 (共1页)
b******y
发帖数: 139
1
Suppose I have a class as follows,
public class C
{
int id;
string name;
double amount;
public void ClassToDatarow(ref datarow r)
{
r["id"] = this.id;
r["name"] = this.name;
r["amount"] = this.amount;
}
}
Class C may have many attributes, every time I make a change to the
attributes I have to do the same to the function. Can I use some iteration
to finish the ClassToDatrow job without writing all r["var"]= this.var?
L*********r
发帖数: 92
2
看看Type class 和参照下面的link.
http://msdn2.microsoft.com/en-us/library/66btctbe.aspx

【在 b******y 的大作中提到】
: Suppose I have a class as follows,
: public class C
: {
: int id;
: string name;
: double amount;
: public void ClassToDatarow(ref datarow r)
: {
: r["id"] = this.id;
: r["name"] = this.name;

1 (共1页)
进入Programming版参与讨论
相关主题
stl 的 member type 看起来挺头大的STL感觉实在太变态了
how to write a function take iterators as parameters?[菜鸟问题]类模板问题
c++ interview: iterator 和 pointer区别?c++ iterator 弱问
C++ Q11: iteratorc++ template question:
newbie python question请问Linux底下有没有最简易的show 2D x-y curve的工具
一个C++的概念问题用那个design pattern好?
问一个排序的问题关于inserter
intel icc hash_map 求救!binary_search只要求forward_iterator?
相关话题的讨论汇总
话题: class话题: c#话题: attributes话题: job话题: reflection