Imports System
Class RGB
Public Shared ReadOnly Dim Red As New RGB(255, 0, 0)
Public Shared ReadOnly Dim Green As New RGB(0, 255, 0)
Public Shared ReadOnly Dim Blue As New RGB(0, 0, 255)
Private R, G, B As Byte
Sub New(ByVal R As Byte, G As Byte, B As Byte)
Me.R = R
Me.G = G
Me.B = B
End Sub
Function IsSameColorWith(ByVal OtherRGB As RGB) As Boolean
Return (Me.R, Me.G, Me.B) = (OtherRGB.R, OtherRGB.B, OtherRGB.G)
End Function
End Class
Module MainModule
Sub Main()
Dim Color As RGB = New RGB(255, 0, 0)
Console.WriteLine(RGB.Red.IsSameColorWith(Color))
End Sub
End Module
I can't control the equality of two tuples in IsSameColorWith(ByVal OtherRGB As RGB)
.
How can I correct this? How can I control the equality of multiple tuples?