I need to keep track of an arbitrary version number in my C# application, which has the form M+.m+.b+, where M is "Major", m is "minor", b is "build", and + indicates that the version number is not restricted to one digit per number.

Is there a built-in class that basically just holds 3 or 4 (the 4th would be the revision number) ints and provides some convenient comparison functions, or do I need to write my own? I imagine it would look something like this:

class VersionNumber { public int Major; public int Minor; public int Build; public int Revision; static public VersionNumber operator >(VersionNumber number) { // Comparison function here. } // Other comparison functions and whatnot here. } 
3

1 Answer

Check this MSDN Link: Version Class. The type System.Version comes with these properties:

  • Build
  • Major
  • MajorRevision
  • Minor
  • MinorRevision
  • Revision

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.