区域指令改进
#Region 指令现在可以放在方法中,甚至可以跨越方法,类和模块。
#Region "A Region Spanning A Class and Ending Inside Of A Method In A Module"
Public Class FakeClass
'Nothing to see here, just a fake class.
End Class
Module Extensions
''' <summary>
''' Checks the path of files or directories and returns [TRUE] if it exists.
''' </summary>
''' <param name="Path">[Sting] Path of file or directory to check.</param>
''' <returns>[Boolean]</returns>
<Extension>
Public Function PathExists(ByVal Path As String) As Boolean
If My.Computer.FileSystem.FileExists(Path) Then Return True
If My.Computer.FileSystem.DirectoryExists(Path) Then Return True
Return False
End Function
''' <summary>
''' Returns the version number from the specified assembly using the assembly's strong name.
''' </summary>
''' <param name="Assy">[Assembly] Assembly to get the version info from.</param>
''' <returns>[String]</returns>
<Extension>
Friend Function GetVersionFromAssembly(ByVal Assy As Assembly) As String
#End Region
Return Split(Split(Assy.FullName, ",")(1), "=")(1)
End Function
End Module