Skip to content

Commit

Permalink
More nullability work on IShellFolder
Browse files Browse the repository at this point in the history
  • Loading branch information
dahall committed Nov 20, 2023
1 parent c5ecf5e commit 4dddb15
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PInvoke/Shell32/ShObjIdl.IShellFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!;
}

/// <summary>A standard OLE enumerator used by a client to determine the available search objects for a folder.</summary>
Expand Down Expand Up @@ -2359,7 +2359,7 @@ public static IEnumerable<PIDL> EnumObjects(this IShellFolder sf, SHCONTF grfFla
public static T GetUIObjectOf<T>(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!;
}

/// <summary>Extension method to simplify using the <see cref="IShellFolder.GetUIObjectOf"/> method.</summary>
Expand All @@ -2377,7 +2377,7 @@ public static T GetUIObjectOf<T>(this IShellFolder sf, HWND hwndOwner, params In
public static HRESULT GetUIObjectOf<T>(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;
}

Expand Down

0 comments on commit 4dddb15

Please sign in to comment.