ManagementFrameworkVersion.IsEqual(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a value indicating whether .NET Framework versions are equal.
public:
bool IsEqual(System::String ^ versionIdentifier);
public bool IsEqual (string versionIdentifier);
member this.IsEqual : string -> bool
Public Function IsEqual (versionIdentifier As String) As Boolean
Parameters
- versionIdentifier
- String
The .NET Framework version without the initial "v".
Returns
true
if the versionIdentifier
parameter is equal to the current management .NET Framework version; otherwise, false
.
Examples
The following example implements a custom method that is equivalent to the IsEqual method.
public bool IsEqual(string versionIdentifier) {
if (String.IsNullOrEmpty(versionIdentifier)) {
if (_version.Major == 0 && _version.Minor == 0) {
return true;
}
return false;
}
string stringVersion = "v" + _version.ToString();
if (String.Compare(stringVersion, versionIdentifier, StringComparison.Ordinal) == 0) {
return true;
}
return false;
}
Public Function IsEqual(ByVal versionIdentifier As String) As Boolean
If String.IsNullOrEmpty(versionIdentifier) Then
Return ((Me._version.Major = 0) AndAlso (Me._version.Minor = 0))
End If
Return (String.Compare(("v" & Me._version.ToString), versionIdentifier, StringComparison.Ordinal) = 0)
End Function
Remarks
This method returns true
if both the .NET Framework major and minor versions specified in the Version property are equal to 0 and the versionIdentifier
parameter is null
or empty.