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 !!

Comments

Popular posts from this blog

Wix: How to hide the License Agreement dialog in Mondo UI

WPF: TreeView example (Part 4)