简体   繁体   中英

Find out latest version

I would like to get the logic to find out latest versions among two version numbers for eg for blackberry mobile OS, it will return the version number like this '6.0.1'. Some other os might return 6.1 only or 6.1.2.4 something like that. I wish to get logic in C# to find the latest version of the provided version numbers.

for egi Find the latest of the below

1. 5.2.4 
2. 6.1.6

ii.

1. 6.1.4.6
2. 1.8.4.2

You can use the Version class:

static Version Max(Version x, Version y)
{
    if (x >= y)
        return x;
    return y;
}

If you have the versions as strings, you can parse them with Version.Parse .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM