IPv4: Add implicit casting to System.Net.IPAddress
ln.build - build0.l--n.de build job pending
Details
ln.build - build0.l--n.de build job pending
Details
parent
db015ed6db
commit
5ed8193971
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace ln.type
|
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 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());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue