派生的 System.Data 类
我想利用继承 System.Data 名称空间的类。
具体来说,我希望分别从 DataColumn、DataTable 和 Dataset 派生类 CarColumn、CarTable 和 CarSet。
我希望能够为每个类添加额外的属性。 作为一个例子,这就是我想要引用类中的项目的方式:
CarSet.CarTable(0).Columns(0).foo
CarSet.CarTable(0).bar
我知道VB.Net不支持多重继承。 实现这一目标的最佳方法是什么?
谢谢, 保罗
I would like to utilize classes that inherit the System.Data name space.
Specifically, I would like to have classes CarColumn, CarTable, and CarSet derived from DataColumn, DataTable, and Dataset respectively.
I would like to be able to add additional properities to each class. As an example this is how I would like to reference items within the classes:
CarSet.CarTable(0).Columns(0).foo
CarSet.CarTable(0).bar
I know that VB.Net is not capable of Multi-Inheritance. What is the best way to achieve this?
Thanks,
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不相信你能以简单的方式实现你想要的。 我相信您必须分别子类化 CarColumn、CarDataRow、CarTable 和 CarDataSet(可能还有 CarDataView/CarDataRowView )。
您是否有机会使用另一种设计,例如 LINQ?
I don't believe you can achieve what you want in an easy way. I believe you'll have to subclass CarColumn, CarDataRow, CarTable, and CarDataSet individually (and probably a CarDataView/CarDataRowView in there somewhere as well).
Is there any chance you can use another design, perhaps LINQ?