IPv4: Add implicit casting to System.Net.IPAddress
ln.build - build0.l--n.de build job pending Details

master
Harald Wolff 2021-07-10 01:38:42 +02:00
parent db015ed6db
commit 5ed8193971
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Net;
namespace ln.type
{
@ -37,7 +38,8 @@ namespace ln.type
public static IPv4 operator +(IPv4 ip, int n) => new IPv4((uint)(ip._ip + n));
public static IPv4 operator -(IPv4 ip, int n) => new IPv4((uint)(ip._ip - n));
public static implicit operator IPAddress(IPv4 ipv4) => new IPAddress(ipv4.ToBytes);
public static implicit operator IPv4(IPAddress ipAddress) => new IPv4(ipAddress.GetAddressBytes());
}
}