Does anyone know if you can use the comparison operators like ==, >=, <=, >, < etc... on two different System.Version objects to detect different versions and in what direction (like which of the two is a newer version vs older?)

I believe that it doesn't (although I could be wrong). However you can extend the class and override those operators to suit your needs.

System.Version cannot be inherited. But it already has the operators overloaded.
Higher version numbers are greater than lower version numbers. Higher version numbers are newer, if you are doing it right.

Comments
Thanks for the correction and explanation :)

Depents what type are these different versions. If they are both numbers you can use:
==, >=, <=, >, < (all of them).
If they are a string you cannot use any. Becuase it will simply not work. YOu cannot compare the difference in the string, you can only compare if they are same (or different) lenght, or they are equal (or not); meaning if they are really equal (like: "aaa" == "aaa" > true, "aaa" != "aaa" > false, "aaa" == "aab" > false

You see the difference?
Mitja

Great. Thanks!

I was looking for a way to put a command version in each command I send over the network so if/when different versions of a command set come out, if something changes, the server still will have backwards capabilities. Guess I'll use something other than System.Version for this.

Thanks!

This question has already been answered. Start a new discussion instead.