I was successfully using this code in the 4.2 framework to get the MAC address.
Private Function getMacAddress(ByVal seperator As String) As String Dim netIF As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces() Dim macAddress As String = "" ' Create a character array for hexidecimal conversion.' Const hexChars As String = "0123456789ABCDEF" ' Loop through the bytes.' For b As Integer = 0 To 5 ' Grab the top 4 bits and append the hex equivalent to the return string.' macAddress += hexChars(netIF(0).PhysicalAddress(b) >> 4) ' Mask off the upper 4 bits to get the rest of it.' macAddress += hexChars(netIF(0).PhysicalAddress(b) And &HF) ' Add the dash only if the MAC address is not finished.' If b < 5 Then macAddress += seperator Next Return macAddress End Function
But after having to upgrade to 4.3 when I setup my new computer, the code-check underlines the code
netIF(0).PhysicalAddress(b) >> 4
and gives this error if I try to deploy:
Error 1 Type 'System.Nullable(Of )' is not defined.
If I remove the ">> 4" part of the line the code-check is happy. So why is that operator not supported? Do I need a special import now?