比较.NET框架中的两个数字字符串 [英] Compare two numeric string in .NET framework

查看:64
本文介绍了比较.NET框架中的两个数字字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作基于Windows的软件,我想添加版本检查器。

我试试这个...但它只能比较两个字符串,如1.3,2.1等等......但是当我做2.1.1时它显示错误。如果我的产品版本是3.1.4我也不能使用此代码。错误显示。我现在该怎么办



我的产品版本是:3.1.4

新版本是:3.2.1

如何比较?



我尝试过:



 double num = 1.3; 
double dnum = 1.545;
if(num> num)
{
MessageBox.Show(New Update Found);
}
else
{
MessageBox.Show(No new found);
}

解决方案

检查这个 c# - 比较版本号 [ ^

I am making a windows based software I wanted to add version checker.
I try this ...But it can only compare two string like 1.3,2.1 etc etc... but when i do 2.1.1 it shows error. if my product version is 3.1.4 i cant also do that with this code. error shows. what can i do now

My Product Version Is : 3.1.4
And New Version is : 3.2.1
how to compare ?

What I have tried:

double num = 1.3;
     double dnum = 1.545;
     if (num > num)
          {
             MessageBox.Show("New Update Found");
          }
          else
          {
              MessageBox.Show("No new found");
          }

解决方案

check this c# - Compare version numbers [^]


这篇关于比较.NET框架中的两个数字字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆