Given List
I need to sort the list of IP addresses in a logical order (i.e. \"192.168.0.2\" comes before \
This one is pretty elegant (and fail proof if you use TryParse):
var sorted2 = from ip in ips
let addressBytes = IPAddress.Parse(ip).GetAddressBytes()
orderby addressBytes[0], addressBytes[1], addressBytes[2], addressBytes[3]
select ip;
The addressBytes array will have length 4 as long as it is only IP4 addresses. Otherwise you should account for the length...