我在 VB 中获得正确的 XmlData 语法时遇到了一些挑战。
这是可以的:
_
; _
但我想添加 FilePath 或 ResourcePath:
_
; _
<测试()> _
; _
VS 显示“名称‘ResourcePath’未声明。VS
Intellisense 显示 8 个参数。如果我像这样编写 XmlData 属性:
_
_
VS 抱怨“‘Public Sub New (ItemPath As String)’的参数太多”
您会注意到,在此错误消息中 VS 显示仅需要一个参数。
但是,如果您键入
。Ed
I'm running into some challenges with getting the syntax correct for XmlData in VB.
This is OK:
<Test()> _
<XmlData("//data")> _
But I want to add either FilePath or ResourcePath:
<Test()> _
<XmlData("//data", ResourcePath = "Data.xml")> _
<Test()> _
<XmlData("//data", FilePath = "Data.xml")> _
VS displays "Name 'ResourcePath' not declared.
VS Intellisense shows 8 parameters. If I write the XmlData attribute like this:
<Test()> _
<XmlData("//data", , , , "Data.xml", , ,)> _
VS complains 'Too many arguments to 'Public Sub New (ItemPath As String)''
You'll note that in this error message VS shows there is only ONE parameter expected.
However, if you type <XmlData( - VS shows list of EIGHT parameters are expected.
Ed
发布评论
评论(1)
VB.NET 语法使用
:=
而不是=
作为属性,因此它是The VB.NET syntax uses
:=
instead of=
for attribute properties, so it would be