From 4dddb1529c45b862841cc48c30059923649f8197 Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 20 Nov 2023 07:46:35 -0700 Subject: [PATCH] More nullability work on IShellFolder --- PInvoke/Shell32/ShObjIdl.IShellFolder.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PInvoke/Shell32/ShObjIdl.IShellFolder.cs b/PInvoke/Shell32/ShObjIdl.IShellFolder.cs index 2a9a37600..638bba34c 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellFolder.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellFolder.cs @@ -482,7 +482,7 @@ public interface ICategoryProvider public static ICategorizer CreateCategory(this ICategoryProvider prov, in Guid pguid) { prov.CreateCategory(pguid, typeof(ICategorizer).GUID, out var ppv).ThrowIfFailed(); - return (ICategorizer)ppv; + return (ICategorizer)ppv!; } /// A standard OLE enumerator used by a client to determine the available search objects for a folder. @@ -2359,7 +2359,7 @@ public static IEnumerable EnumObjects(this IShellFolder sf, SHCONTF grfFla public static T GetUIObjectOf(this IShellFolder sf, HWND hwndOwner, params IntPtr[] apidl) where T : class { sf.GetUIObjectOf(hwndOwner, (uint)apidl.Length, apidl, typeof(T).GUID, default, out var o).ThrowIfFailed(); - return (T)o; + return (T)o!; } /// Extension method to simplify using the method. @@ -2377,7 +2377,7 @@ public static T GetUIObjectOf(this IShellFolder sf, HWND hwndOwner, params In public static HRESULT GetUIObjectOf(this IShellFolder sf, IntPtr[] apidl, out T? ppv, HWND hwndOwner = default) where T : class { var hr = sf.GetUIObjectOf(hwndOwner, (uint)apidl.Length, apidl, typeof(T).GUID, default, out var o); - ppv = hr.Succeeded ? (T)o : default; + ppv = hr.Succeeded ? (T)o! : default; return hr; }