FrameworkName.Equality Operator (FrameworkName, FrameworkName)

.NET Framework (current version)

Returns a value that indicates whether two FrameworkName objects represent the same .NET Framework version.

Namespace:   System.Runtime.Versioning
Assembly:  System (in System.dll)

Public Shared Operator = (
	left As FrameworkName,
	right As FrameworkName
) As Boolean


Type: System.Runtime.Versioning.FrameworkName

The first object to compare.

Type: System.Runtime.Versioning.FrameworkName

The second object to compare.

Return Value

Type: System.Boolean

true if the left and right parameters represent the same .NET Framework version; otherwise, false.

The Equality method defines the operation of the equality operator for FrameworkName objects.

Languages that do not support custom operators can call the FrameworkName.Equals(FrameworkName) method instead.

The following example uses the equality operator to determine whether a FrameworkName object that represents the running version of the .NET Framework is equal to a supported version of the .NET Framework. Note that the two versions are not equal because they do not have identical version numbers.

Dim supportedVer1 As New FrameworkName(".NET Framework, Version=4.0")
Dim actualVersion As New FrameworkName(String.Format(".NET Framework, Version={0}", 

Console.WriteLine("Supported Version: {0}", supportedVer1)
Console.WriteLine("Actual Version:    {0}", actualVersion)
If supportedVer1 = actualVersion Then
   Console.WriteLine("The supported and actual Framework versions are the same.")
   Console.WriteLine("The supported and actual Framework versions are different.")
End If 
' The example displays the following output:
'      Supported Version: .NET Framework,Version=v4.0
'      Actual Version:    .NET Framework,Version=v4.0.30319.18010
'      The supported and actual Framework versions are different.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.0
Return to top