ComScope<T>
struct ComScope<T> where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType), IComIID
Lifetime management struct for a native COM pointer. Meant to be utilized in a using statement
to ensure Release is called when going out of scope with the using.
public static ComScope<T> QueryFrom<TFrom>(TFrom* from) where TFrom : ValueType modreq(System.Runtime.InteropServices.UnmanagedType), IComIID
Create a ComScope<T> from the given COM interface. Throws on failure.
public static ComScope<T> TryQueryFrom<TFrom>(TFrom* from, out HRESULT hr) where TFrom : ValueType modreq(System.Runtime.InteropServices.UnmanagedType), IComIID
Attempt to create a ComScope<T> from the given COM interface.
public ComScope<TTo> Query<TTo>() where TTo : ValueType modreq(System.Runtime.InteropServices.UnmanagedType), IComIID
Queries the requested interface into a new ComScope<T>.
public bool SupportsInterface<TInterface>() where TInterface : ValueType modreq(System.Runtime.InteropServices.UnmanagedType), IComIID
Simple helper for checking if a given interface is supported. Only use this if you don't intend to
use the interface, otherwise use TryQuery<T>.
public ComScope<TTo> TryQuery<TTo>(out HRESULT hr) where TTo : ValueType modreq(System.Runtime.InteropServices.UnmanagedType), IComIID
Tries querying the requested interface into a new ComScope<T>.