Re: Funny Comparison with Float

silky <[email protected]> Fri, 7 Mar 2008 09:56:19 +1100
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
On Fri, Mar 7, 2008 at 2:38 AM, Rich Armstrong <[email protected]> wrote:
>  Of course it may or may not be appropriate for the original poster's pur=
pose,
>  but if someone were looking for a better way to represent a version than=
 a float
>  or double, it's worth considering.

I personally use a string which I then convert to a long for
comparisions. It does mean that I make my version numbers a fixed
maximum length (6 chars per segment) but then I can just extend out
each segment and whack it into one long which I then compare
trivially.


>  If you do need versions with more than two parts ("in a normal kind of w=
ay"),
>  System.Version provides some nice features, like comparison semantics an=
d the
>  various ToString() overloads.  We've used it to version all sorts of non=
-CLR
>  things; my only complaint has been that the class is sealed, forcing us =
to write
>  a wrapper class for one of our applications.
>
>  Just my 2=A2.

--=20
http://lets.coozi.com.au/

There's not a problem I can't fix, because I can do it in the mix.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This list is hosted by DevelopMentor=AE  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com