C# convert hex into ip
问题 i have hex values in the format of 4a0e94ca etc, and i need to convert them into IP's, how can i do this in C# ? 回答1: If the values represent IPv4 addresses you can use the long.Parse method and pass the result to the IPAddress constructor: var ip = new IPAddress(long.Parse("4a0e94ca", NumberStyles.AllowHexSpecifier)); If they represent IPv6 addresses you should convert the hex value to a byte array and then use this IPAddress constructor overload to construct the IPAddress. 回答2: Well, take