![](/img/trans.png)
[英]Best way to use a VB.NET class library from a C++ DLL?
[英]VB.Net OOP/DLL List from a class?
是否可以在VB.Net Runtime 4.5中创建一个可以称为DLL的命名对象,还是必须使用C#?
Object.UpdateType.Kind = Object.UpdateType.UpdateTypeOne
Dim x as New Field
x.Name = "Foo"
Object.UpdateType.Fields.Add(X)
我遇到的真正问题是让Fields成为UpdateType类中的列表。
Public Class Object
Public Class UpdateType
strFields As New List(Of Field)
Public Class Field
strName As String = String.Empty
Public Property Name As String
Get
Return strName
End Get
Set (Value As String)
strName = Value
End Set
End Property
End Class
Public Const UpdateTypeOne As Byte = 1
Public Property Kind As Byte
Get
Return bytKind
End Get
Set (Value as Byte)
bytKind = Value
End Set
End Property
Public Function Fields As List(Of Field)
' This part is not making sense to me!
Return strFields
End Function
End Class
End Class
再次输入对象。 我希望UpdateType是Intellisense中的一个选择。 从Intellisense中选择UpdateType后,我希望Kind与Fields一起成为一种选择。
这种类型需要使用该语法接受Object.UpdateType.UpdateTypeOne常量,而不是仅将值1放在其位置。
字段必须是我可以在EXE中添加和删除的字段对象的列表或集合。 我还希望能够计算字段列表或集合中的项目数。
先感谢您! -法案
我将嵌套的Class
和Enum
分开,然后将它们全部放在命名空间中。 由于Fields
是Public
变量,因此您可以访问它以添加和删除Field
对象。 Enum
是一种进行选择的OOP
方法。 然后,您可以使用If Statement
或Select Case
查找选择了哪个选项,并为其运行单独的代码。 看看这是否您需要的。
Namespace Utility
Public Class UpdateObject
Public Fields As New List(Of Field)
Public Property _UpdateType As UpdateType = UpdateType.UpdateTypeOne
Public Property Kind As Byte
End Class
Public Class Field
Public Property Name As String
'...others
End Class
Public Enum UpdateType
UpdateTypeOne
'...others
End Enum
End Namespace
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.