var endpoint = new IPEndPoint(IPAddress.Parse("192.168.0.1"), 80); string endpointString = endpoint.ToString(); //endpointString value will be "192.168.0.1:80"
var endpoint = new IPEndPoint(IPAddress.IPv6Loopback, 8080); string endpointString = endpoint.ToString(); //endpointString value will be "[::1]:8080"This method is part of the System.Net namespace in C# and is included in the .NET Framework Class Library.