FileInfo:将 FileInfo 参数传递给方法

发布于 2024-12-09 06:37:15 字数 496 浏览 3 评论 0原文

我有以下 VB 函数,它采用 FileInfo 对象作为参数:

Public Shared Shadows Sub Start(ByVal filePath As FieldInfo)
XmlConfigurator.ConfigureAndWatch(New System.IO.FileInfo(filePath.ToString()))

End Sub

在另一个类中,我有以下代码调用“Start”方法。但 VisStudio 表明我传递的“FilePath”参数存在问题。提前致谢!

'Initialize FileInfo object to pass to Start method
        Dim path As String =             Dim filePath As FileInfo = New FileInfo(path)

        LoggingManager.Start(**FilePath**)

I have the following VB function which takes a FileInfo object as a parameter:

Public Shared Shadows Sub Start(ByVal filePath As FieldInfo)
XmlConfigurator.ConfigureAndWatch(New System.IO.FileInfo(filePath.ToString()))

End Sub

In another class I have the following code calling that 'Start' method. But VisStudio indicates there is a problem with the 'FilePath' argument that I'm passing. Thanks in advance!

'Initialize FileInfo object to pass to Start method
        Dim path As String =             Dim filePath As FileInfo = New FileInfo(path)

        LoggingManager.Start(**FilePath**)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

青芜 2024-12-16 06:37:15

看起来你错误地声明了 Start 函数,它应该是 FileInfo 而不是 FieldInfo

Public Shared Shadows Sub Start(ByVal filePath As FileInfo)
    XmlConfigurator.ConfigureAndWatch(filePath)
End Sub

It looks like you mis-declared the Start function, it should be FileInfo not FieldInfo

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