When trying to access the returned value I'm told that the object reference is not set to the instance of the object where:
return address.Address;
The code that I used from someone else's thread to extract the gateway IP:
public static IPAddress getDefaultGateway()
{
var card = NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault();
if (card == null) return null;
var address = card.GetIPProperties().GatewayAddresses.FirstOrDefault();
return address.Address;
}