DependencyVersion Class

Encapsulates a version or a version pattern which is used by DependencyVersionRange.

In contradistinction to System.Version, supports versions with single component like 3 and component wildcards like *, 1.*, 2.5.* or 1.7.4.*.

Definition

Namespace: SMath.Extensibility.Setup
Assembly: SMath.Manager (in SMath.Manager.dll) Version: 1.74.9654.0
C#
public sealed class DependencyVersion : IEquatable<Version>, 
	IEquatable<DependencyVersion>, IComparable, IComparable<Version>, 
	IComparable<DependencyVersion>
Inheritance
Object    DependencyVersion
Implements
IComparable, IComparableVersion, IComparableDependencyVersion, IEquatableVersion, IEquatableDependencyVersion

Properties

Build Build part of version; Empty if the part is not specified, Wildcard for a wildcard *.
IsPattern Returns when this DependencyVersion instance is a pattern, i.e., one of its parts contains Wildcard.
Major Major part of version; Empty if the part is not specified, Wildcard for a wildcard *.
Minor Minor part of version; Empty if the part is not specified, Wildcard for a wildcard *.
Revision Revision part of version; Empty if the part is not specified, Wildcard for a wildcard *.
WildcardPosition Zero-based position of Wildcard in this DependencyVersion instance (0 = Major, ..., 3 = Revision) or -1 if this DependencyVersion instance is not a pattern.

Methods

CompareTo(DependencyVersion) Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
CompareTo(Object)Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
CompareTo(Version) Compares the current instance with another object of type Version and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Equals(DependencyVersion) Indicates whether the current object is equal to another object of the same type.
Equals(Object)Determines whether the specified object is equal to the current object.
(Overrides ObjectEquals(Object))
Equals(Version) Indicates whether the current object is equal to another object of type Version.
FromArray Constructs a DependencyVersion instance from array of parts.
FromVersion Constructs a DependencyVersion instance from the specified System.Version instance.
GetHashCodeServes as the default hash function.
(Overrides ObjectGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Parse Parses DependencyVersion from the specified string.
ToMatchingFullVersion Determines the minimal System.Version value with all 4 parts Major, Minor, Build and Revision which matches the version or pattern represented by this DependencyVersion.
ToMatchingFullVersion(Version) Determines the minimal System.Version value with all 4 parts Major, Minor, Build and Revision which matches the specified version.
ToStringReturns a string that represents the current object.
(Overrides ObjectToString)
ToString(Int32)

Returns string representation of DependencyVersion using the specified number of significant version parts.

The significantVersionParts argument is handled in the following way:

significantVersionPartsBehavior
0Version part is written unless its value is Empty.
1 - 4 Trailing zeros are added to the resulting string if the actual number of version parts is less than significantVersionParts. If all part values after significantVersionParts are zeros then they are not added to the output. The output is not affected when IsPattern is .

ToVersion

Converts this instance to System.Version.

Throws InvalidOperationException if IsPattern is or if there is only Major part present in this instance.

TryParse(String, Boolean, DependencyVersion) Attempts to parse DependencyVersion from the specified string.
TryParse(String, Int32, Int32, Boolean, DependencyVersion) Attempts to parse DependencyVersion from the specified substring of the input string.

Fields

AnyVersion Instance of DependencyVersion for pattern "*" which denotes any version.

See Also