Reputation: 1671
Scenario: I needed to keep track of a few random version numbers for a few random things in my code. I wanted to define a class in order to keep track of them and put them into a form in which I can easily call and manipulate. I considered using System.Version but it was described as a class for versioning specific things:
Represents the version number of an assembly, operating system, or the common language runtime.
Question: Is it acceptable to use the System.Version class for things other than "an assembly, operating system, or the common language runtime"?
Upvotes: 3
Views: 1550
Reputation: 9017
It's also worth noting that even Microsoft don't use System.Version in all cases... it is not designed to be a catch-all versioning type in the vein of DateTime.
Upvotes: 1
Reputation: 70142
The System.Version class is very simple, with just a few properties; Build, Major, MajorRevision, ... and not much else. If this fits your needs, and you do not find yourself wth redundant properties on your interface I guess you could use it. However, one thing to watch out for is that System.Version is sealed, so if at any point you find it does not fit your needs and you wish to extend it, you will not be able to.
Personally, with System.Version being such a simple class, and the lack of future extensibility, I would create my own type.
Upvotes: 2