本文整理汇总了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