派生的 System.Data 类

发布于 2024-07-15 07:06:18 字数 338 浏览 6 评论 0原文

我想利用继承 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

榕城若虚 2024-07-22 07:06:19

我不相信你能以简单的方式实现你想要的。 我相信您必须分别子类化 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文