FileInfo:将FileInfo参数传递给方法

时间:2011-10-12 19:58:51

标签: vb.net fileinfo

我有以下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**)

1 个答案:

答案 0 :(得分:0)

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

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