I try to convert Ip Address to uint
:
IPAddress requstedIpAddress;
uint requesteIpAddressUint = (uint)IPAddress.Parse(requstedIpAddress.ToString()).Address;
And got this warning:
'System.Net.IPAddress.Address' is obsolete: 'This property has been deprecated. It is address family dependent. Please use IPAddress.Equals method to perform comparisons.
What does it mean and should i use some other way to do that ?
The deprecation warning tells you that in the next update of your library which has IPAddress
defined, will no longer have IPAddress.Address
as a property. So your code will fail to compile after the next update to the library.
If you go to the documentation for IPAddress.Address it notes that the property is obsolete and should instead use IPAddress.GetAddressBytes.
The deprecation of IPAddress.Address
is due to the adoption of IPv6 which is 128 bits while C# type long
, which is actually a System.Int64, is only 64 bits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With