<PackageReference Include="System.Drawing.Common" Version="11.0.0-preview.1.26104.118" />

Windows.Win32.ObjectScope

struct ObjectScope
Helper to scope lifetime of a GDI object. Deletes the given object (if any) when disposed.
namespace Windows.Win32 { internal readonly ref struct ObjectScope { public HGDIOBJ HGDIOBJ { get; } public ObjectScope(HGDIOBJ object); public static implicit operator HGDIOBJ(ref ObjectScope objectScope); public void Dispose(); } }