String / Version Compare

  • Thread starter Thread starter MDB
  • Start date Start date
M

MDB

Hello All,

Is there a easy way (meaning not spliting on each . ) to compare version
strings to find out which is greater?

For example 001.001.002 is greater than 001.001.001
 
Is there a easy way (meaning not spliting on each . ) to compare version
strings to find out which is greater?

use System.Version:

string s1 ="001.001.002", s2 = "001.001.001";
Version v1 = new Version(s1), v2 = new Version(s2);
if (v1 > v2)
MessageBox.Show("Yes");

Erik
 
Thanks! That is what I was looking for. I heard there was something like
this, just couldn't find it.
 
Back
Top