Tuesday, 11 May 2010

Comparing assembly versions in C#

Found a nice little trick to compare version strings in .NET:

Version version1 = new Version("2.4.1");
Version version2 = new Version("2.5");

if (version1 <= version2)
{
// in this case true
}

No need to rely on string.Compare() method !!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.