检查版本装配范围的逻辑(1.0.0.6) [英] Logic to Check Version Assembly Range (1.0.0.6)
问题描述
我有一项任务来验证版本是否在范围内。版本采用此格式 主要版本,次要版本,构建版本,修订版格式(1.0.0.0)。
I have a task to verify if Version is within range. The Version is in this format Major, Minor, Build, Revision Format (1.0.0.0).
软件版本经常更改。我该怎么做呢?
The version of software changes frequently. How do I go about doing this?
示例
INPUT版本:1.2.0.1
INPUT Version: 1.2.0.1
如何写软件说软件版本(1.2.0.1) 更大> 1.2.0.2,然后做点什么
How do write logic to say Sofware Version (1.2.0.1) is greater > 1.2.0.2, then Do Something
其他软件版本超出范围?
Else Software version is out of range?
pianoboyCoder
pianoboyCoder
推荐答案
您只需将版本加载到 System.Version 实例中。
< a href ="https://msdn.microsoft.com/en-us/library/system.version(v=vs.110).aspx"> https://msdn.microsoft.com/en-us/library/ system.version(v = vs.110).aspx
Version类有一个标准的CompareTo方法,并且还会覆盖比较运算符(<,< =, >等),因此比较版本的值很简单。
the Version class has a standard CompareTo method, and also overrides the comparison operators (<, <=, >, etc), so comparing the values of the versions is straightforward.
这篇关于检查版本装配范围的逻辑(1.0.0.6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!