diff --git a/PInvoke/Ws2_32/ws2spi.cs b/PInvoke/Ws2_32/ws2spi.cs index 0b0982e4..042a44ac 100644 --- a/PInvoke/Ws2_32/ws2spi.cs +++ b/PInvoke/Ws2_32/ws2spi.cs @@ -4428,14 +4428,20 @@ namespace Vanara.PInvoke [StructLayout(LayoutKind.Sequential)] public struct WSAEVENT : ISyncHandle { - private IntPtr handle; + private readonly IntPtr handle; /// Initializes a new instance of the struct. /// An object that represents the pre-existing handle to use. public WSAEVENT(IntPtr preexistingHandle) => handle = preexistingHandle; + /// Represents an invalid event handle. + public static WSAEVENT WSA_INVALID_EVENT => new(IntPtr.Zero); + /// Returns an invalid handle by instantiating a object with . - public static WSAEVENT NULL => new WSAEVENT(IntPtr.Zero); + public static WSAEVENT NULL => new(IntPtr.Zero); + + /// Gets a value indicating whether this instance is invalid. + public bool IsInvalid => handle == IntPtr.Zero; /// Gets a value indicating whether this instance is a null handle. public bool IsNull => handle == IntPtr.Zero; @@ -4448,7 +4454,7 @@ namespace Vanara.PInvoke /// Performs an implicit conversion from to . /// The pointer to a handle. /// The result of the conversion. - public static implicit operator WSAEVENT(IntPtr h) => new WSAEVENT(h); + public static implicit operator WSAEVENT(IntPtr h) => new(h); /// Implements the operator !=. /// The first handle.