public static string CurrentApplicationVersion = "1.0.9";
public static void Main()
public static void RunTest(string version)
var cmp = IsVersionGreaterThanCurrent("1.1.1");
string str = version + " > " + CurrentApplicationVersion + " ? " + (cmp ? "yes": "no");
public static bool IsVersionGreaterThanCurrent(string remoteVersionNumber)
if (string.IsNullOrEmpty(remoteVersionNumber)) return false;
var thisVersionArray = GetVersionArray(CurrentApplicationVersion);
var otherVersionArray = GetVersionArray(remoteVersionNumber);
for (var i = 0; i < otherVersionArray.Length; i++)
var thisVersionValue = (i < thisVersionArray.Length)
if (otherVersionArray[i] > thisVersionValue) return true;
public static int[] GetVersionArray(string versionString)
if (string.IsNullOrEmpty(versionString)) return null;
var splits = versionString.Split('.');
var array = new int[splits.Length];
for (var i = 0; i < splits.Length; i++)
array[i] = int.Parse(splits[i]);