How do I compare version numbers?
For instance:
x = 1.23.56.1487.5
y = 1.24.55.487.2
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Can you use the
Versionclass?https://learn.microsoft.com/en-us/dotnet/api/system.version
It has an
IComparableinterface. Be aware this won’t work with a 5-part version string like you’ve shown (is that really your version string?). Assuming your inputs are strings, here’s a working sample with the normal .NET 4-part version string: