在运行时创建动态类
任何人都可以在运行时创建动态类。我有一个 dictionary
它包含数据表的所有列及其数据类型,我的计划是创建一个基于字典的动态类。表示数据表的列名是类的属性。创建 list
并绑定到网格后,
如果您有代码,将会非常有帮助
can any body have idea for create dynamic class at run time.i have one dictionary<string,object>
which is contains datatable's all columns with it's datatype my plan is to create a dynamic class base on dictionary. means datatable's column name is property of class. after create list<dynamic class>
and bind to grid
it's grate help if you have code for it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Silverlight 上的元编程相当有限,但是
TypeBuilder
可能就是您正在寻找的。不过,一个更简单的选择是使用ExpandoObject
和dynamic
,但坦率地说:您还不如只使用字典。我不确定我是否会为此费心进行元编程。如果您确实走这条路,您可以通过以下方式获得一个新的空列表:
meta-programming on Silverlight is fairly limited, but
TypeBuilder
is probably what you are looking for. An easier option, though, is to useExpandoObject
anddynamic
, but frankly: you might as well just use the dictionary. I'm not sure I'd bother going to the trouble of meta-programming for this.If you do go that route, you can get a new empty list via: