VersionNumber

References
Represents a product version number that encodes major, minor, time and build branch information. as major.minor.yyddd.hhmmb where: yy = year of build - 2000 ddd = year day of build (1-366) hh = hour of build mm = minute of build b = branch of build

Constructors

VersionNumber

#
public VersionNumber(int major, int minor, DateTime time, Branch buildBranch)
Initializes a new instance of the VersionNumber structure to the version specified by the parameters.
major (int)The major version number (0 through 63).
minor (int)The minor version number (0 through 127).
time (DateTime)The time is the version time (January 1, 2000 00:00 through December 31 23:59). Seconds are ignored.
buildBranch (VersionNumber.Branch)The branch used to build the product (developer, trunk, release_candidate, or release).

VersionNumber

#
public VersionNumber(int majorVersionNumber, int minorVersionNumber, int versionQuartetYyddd, int versionQuartetHhmmb)
Initializes a new instance of the VersionNumber structure to the version specified by the version quartet values.
majorVersionNumber (int)The major version number (0 through 63).
minorVersionNumber (int)The minor version number (0 through 127)
versionQuartetYyddd (int)The third version quartet value is (year - 2000)*1000 + yday, where year is 2000 to 2099 and yday is 1 to the number of days in the specified year.
versionQuartetHhmmb (int)The forth version quartet value is (hour*1000 + minute*10 + branch) where hour is 0 to 23, minute is 0 to 59, and branch is 0 to 3.

VersionNumber

#
public VersionNumber(Version version)
Construct VersionNumber based on existing System.Version class.
version (Version)

Properties

BuildBranch

#
public VersionNumber.Branch BuildBranch { get; }
Gets the build branch component of this instance.

IsValid

#
public bool IsValid { get; }
True when all information in the VersionNumber has valid values.

Major

#
public int Major { get; }
Gets the major version number component of this instance.

MaxMajorVersionNumber

#
public static int MaxMajorVersionNumber { get; }
The largest possible valid value of VersionNumber.MajorVersionNumber.

MaxMinorVersionNumber

#
public static int MaxMinorVersionNumber { get; }
The largest possible valid value of VersionNumber.MinorVersionNumber.

MaxValid

#
public static VersionNumber MaxValid { get; }
The largest possible valid VersionNumber.

MaxValidBuildBranch

#
public static VersionNumber.Branch MaxValidBuildBranch { get; }
Represents the largest possible valid value of VersionNumber.BuildBranch. This field is read-only.

MaxValidTime

#
public static DateTime MaxValidTime { get; }
The largest possible valid value of VersionNumber.Time. This field is read-only.

MinMajorVersionNumber

#
public static int MinMajorVersionNumber { get; }
The smallest possible valid value of VersionNumber.MajorVersionNumber.

MinMinorVersionNumber

#
public static int MinMinorVersionNumber { get; }
The smallest possible valid value of VersionNumber.MinorVersionNumber.

Minor

#
public int Minor { get; }
Gets the minor version number component of this instance.

MinValid

#
public static VersionNumber MinValid { get; }
The smallest possible valid VersionNumber.

MinValidBuildBranch

#
public static VersionNumber.Branch MinValidBuildBranch { get; }
Represents the smallest possible valid value of VersionNumber.BuildBranch. This field is read-only.

MinValidTime

#
public static DateTime MinValidTime { get; }
The smallest possible valid value of VersionNumber.Time. This field is read-only.

Time

#
public DateTime Time { get; }
Gets the version time component of this instance.

Unset

#
public static VersionNumber Unset { get; }
The Unset VersionNumber. VersionNumber.Unset.IsValid is false.

UnsetBuildBranch

#
public static VersionNumber.Branch UnsetBuildBranch { get; }
The value of an Unset VersionNumber.BuildBranch.

UnsetTime

#
public static DateTime UnsetTime { get; }
The value of an Unset VersionNumber.Time.

Methods

CompareTo

#
public int CompareTo(object value)
Compares the value of this instance to a specified VersionNumber value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified VersionNumber value.
value (object)The object to compare to the current instance.
A signed number indicating the relative values of this instance and the value parameter. Less than zero indicates this instance is earier than value. Zero indicates this instance is the same as value. Greater than zero indicates this instance is later than value.

CompareTo

#
public int CompareTo(VersionNumber value)
Compares the value of this instance to a specified VersionNumber value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified VersionNumber value.
value (VersionNumber)The object to compare to the current instance.
A signed number indicating the relative values of this instance and the value parameter. Less than zero indicates this instance is earier than value. Zero indicates this instance is the same as value. Greater than zero indicates this instance is later than value.

ToString

#
public override string ToString()
Converts the value of the current VersionNumber object to its equivalent string representation major.minor.yyddd.hhmmb. (Overrides ValueType.ToString().)

ToVersion

#
public Version ToVersion()
Convert this VersionNumber class to System.Version()

TryParse

#
public static bool TryParse(string s, out VersionNumber result)
Converts the specified string representation of a version number to its VersionNumber equivalent and returns a value that indicates whether the conversion succeeded.
s (string)A string containing four integers separated by full stops in the format major.minor.yyddd.hhmmb, where yy is year-2000, ddd is the day of the year, hh is the hour, mm is the minute and b identifies the build branch.
result (out VersionNumber)When this method returns, result contains the VersionNumber value equivalent to the version number contained in s, if the conversion succeeded, or VersionNumber.Unset if the conversion failed. The conversion fails if the s parameter is null, is an empty string (""), or does not contain a valid string representation of version number. This parameter is passed uninitialized.

TryParse

#
public static bool TryParse(Version v, out VersionNumber result)
Attempt so convert the System.Version representation of a version number to its VersionNumber equivalent and returns a value that indicates whether the conversion succeeded.
v (Version)A version number with quartet values (v.Major, v.Minor, v.Build, v.Revision) that are valid ((0 to 63),(0 to 127), (1 to 99365), (0 to 23593)).
result (out VersionNumber)When this method returns, result contains the VersionNumber value equivalent to the version number contained in v, if the conversion succeeded, or VersionNumber.Unset if the conversion failed. The conversion fails if the v parameter is null, is an empty string (""), or does not contain a valid string representation of version number. This parameter is passed uninitialized.