From 8eb8b174a19d002ac163337d3393c7ae7faf0051 Mon Sep 17 00:00:00 2001 From: dahall Date: Mon, 28 Dec 2020 15:17:47 -0700 Subject: [PATCH] Added explicit conversion from SOCKADDR_STORAGE to SOCKADDR_IN and SOCKADDR_IN6 --- PInvoke/Ws2_32/ws2def.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PInvoke/Ws2_32/ws2def.cs b/PInvoke/Ws2_32/ws2def.cs index 219dc232..61b714d6 100644 --- a/PInvoke/Ws2_32/ws2def.cs +++ b/PInvoke/Ws2_32/ws2def.cs @@ -1418,6 +1418,16 @@ namespace Vanara.PInvoke /// The addr. /// The resulting instance from the conversion. public static explicit operator SOCKADDR(SOCKADDR_STORAGE addr) => SOCKADDR.CreateFromStructure(addr); + + /// Performs an explicit conversion from to . + /// The addr. + /// The resulting instance from the conversion. + public static explicit operator SOCKADDR_IN(SOCKADDR_STORAGE addr) => (SOCKADDR_IN)SOCKADDR.CreateFromStructure(addr); + + /// Performs an explicit conversion from to . + /// The addr. + /// The resulting instance from the conversion. + public static explicit operator SOCKADDR_IN6(SOCKADDR_STORAGE addr) => (SOCKADDR_IN6)SOCKADDR.CreateFromStructure(addr); } /// The SOCKET_ADDRESS structure stores protocol-specific address information.