當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET Version類代碼示例

本文整理匯總了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
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:14,代碼來源:Version

輸出:

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())
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:4,代碼來源:Version

示例3:

' Get the common language runtime version.
Dim ver As Version = Environment.Version
Console.WriteLine("CLR Version {0}", ver.ToString())
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:3,代碼來源:Version

示例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
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:12,代碼來源:Version

示例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
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:12,代碼來源:Version

示例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
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:13,代碼來源:Version

示例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
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:9,代碼來源:Version

示例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)
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:12,代碼來源:Version

輸出:

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
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:21,代碼來源:Version

輸出:

Relationship of 1.1 to 1.1.0: Earlier
Relationship of 1.1.0.0 to 1.1.0: Later


注:本文中的System.Version類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。