// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Net; namespace E { public class MainClass { public static void Main(string[] args) { IPAddress adr = IPAddress.Parse("127.0.0.1"); int ip1 = (int)adr.Address; Console.WriteLine(ip1); int ip2 = BitConverter.ToInt32(adr.GetAddressBytes(), 0); Console.WriteLine(ip2); byte[] b = adr.GetAddressBytes(); int ip3 = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; Console.WriteLine(ip3); } } }