本文整理匯總了VB.NET中System.Version類的典型用法代碼示例。如果您正苦於以下問題:VB.NET Version類的具體用法?VB.NET Version怎麽用?VB.NET Version使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Version類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example1
' 導入命名空間
Imports System.Reflection
<Assembly:AssemblyVersionAttribute("2.0.1")>
Module Example1
Public Sub Main()
Dim thisAssem As Assembly = GetType(Example1).Assembly
Dim thisAssemName As AssemblyName = thisAssem.GetName()
Dim ver As Version = thisAssemName.Version
Console.WriteLine("This is version {0} of {1}.", ver, thisAssemName.Name)
End Sub
End Module
輸出:
This is version 2.0.1.0 of Example1.
示例2:
' Get the operating system version.
Dim os As OperatingSystem = Environment.OSVersion
Dim ver As Version = os.Version
Console.WriteLine("Operating System: {0} ({1})", os.VersionString, ver.ToString())
示例3:
' Get the common language runtime version.
Dim ver As Version = Environment.Version
Console.WriteLine("CLR Version {0}", ver.ToString())
示例4: Example
' 導入命名空間
Imports System.Reflection
Module Example
Public Sub Main()
' Get the version of the executing assembly (that is, this assembly).
Dim assem As Assembly = Assembly.GetEntryAssembly()
Dim assemName As AssemblyName = assem.GetName()
Dim ver As Version = assemName.Version
Console.WriteLine("Application {0}, Version {1}", assemName.Name, ver.ToString())
End Sub
End Module
示例5: Example
' 導入命名空間
Imports System.Reflection
Module Example
Public Sub Main()
' Get the version of the current assembly.
Dim assem As Assembly = GetType(Example).Assembly
Dim assemName As AssemblyName = assem.GetName()
Dim ver As Version = assemName.Version
Console.WriteLine("{0}, Version {1}", assemName.Name, ver.ToString()) VB
End Sub
End Module
示例6: Example
' 導入命名空間
Imports System.Reflection
Module Example
Public Sub Main()
' Get the version of a specific assembly.
Dim filename As String = ".\StringLibrary.dll"
Dim assem As Assembly = Assembly.ReflectionOnlyLoadFrom(filename)
Dim assemName As AssemblyName = assem.GetName()
Dim ver As Version = assemName.Version
Console.WriteLine("{0}, Version {1}", assemName.Name, ver.ToString())
End Sub
End Module
示例7: Example
' 導入命名空間
Imports System.Deployment.Application
Module Example
Public Sub Main()
Dim ver As Version = ApplicationDeployment.CurrentDeployment.CurrentVersion
Console.WriteLine("ClickOnce Publish Version: {0}", ver)
End Sub
End Module
示例8: Version
Dim v1 As New Version(2,0)
Dim v2 As New Version("2.1")
Console.Write("Version {0} is ", v1)
Select Case v1.CompareTo(v2)
Case 0
Console.Write("the same as")
Case 1
Console.Write("later than")
Case -1
Console.Write("earlier than")
End Select
Console.WriteLine(" Version {0}.", v2)
輸出:
Version 2.0 is earlier than Version 2.1.
示例9: Example
Public Enum VersionTime
Earlier = -1
Same = 0
Later = 1
End Enum
Module Example
Public Sub Main()
Dim v1 As New Version(1, 1)
Dim v1a As New Version("1.1.0")
ShowRelationship(v1, v1a)
Dim v1b As New Version(1, 1, 0, 0)
ShowRelationship(v1b, v1a)
End Sub
Private Sub ShowRelationship(v1 As Version, v2 As Version)
Console.WriteLine("Relationship of {0} to {1}: {2}",
v1, v2, CType(v1.CompareTo(v2), VersionTime))
End Sub
End Module
輸出:
Relationship of 1.1 to 1.1.0: Earlier Relationship of 1.1.0.0 to 1.1.0: Later