VB.NET中是否有从给定目录对象获取路径对象的函数?
我正在编写这样一个函数:VB.NET中是否有从给定目录对象获取路径对象的函数?,vb.net,Vb.net,我正在编写这样一个函数: Private Function mostRecent(ByVal folder As Directory) As Date 'function to convert the given directory param as a path obj Dim foldPathStr = Path.GetFullPath(foldPath) Dim createDate As Date = Directory.GetCreationTime(fo
Private Function mostRecent(ByVal folder As Directory) As Date
'function to convert the given directory param as a path obj
Dim foldPathStr = Path.GetFullPath(foldPath)
Dim createDate As Date = Directory.GetCreationTime(foldPathStr)
Dim writeDate As Date = Directory.GetLastWriteTime(foldPathStr)
Dim readDate As Date = Directory.GetLastAccessTime(foldPathStr)
If createDate > writeDate And createDate > readDate Then
Return createDate
ElseIf writeDate > createDate And writeDate > readDate Then
Return writeDate
ElseIf readDate > createDate And readDate > writeDate Then
Return readDate
End If
End Function
如果可以的话,我想用一个内置命令来填充注释行。如果不是,我想我会更改参数。是一个静态类-它从未实例化;从来没有路径
对象的实例
假设我们在这里讨论的是同一个路径
类。。。我有点惊讶于将其视为参数类型,因为它也是一个静态类。你确定你不是这个意思吗?或者这是一个与System.IO
类同名的VB类,只是为了迷惑粗心的C#开发者
如果是DirectoryInfo
,我想你只是想要这个属性