Class DXUtils
Utility methods.
Inherited Members
Namespace: JeremyAnsel.DirectX.DXCommon
Assembly: JeremyAnsel.DirectX.DXCommon.dll
Syntax
public static class DXUtils
Methods
| Edit this page View SourceAddRef(nint)
Add reference to COM object.
Declaration
public static int AddRef(nint comPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | comPtr | The com interface. |
Returns
| Type | Description |
|---|---|
| int | The reference count. |
DisposeAndNull<T>(Span<T?>)
Immediately releases the unmanaged resources.
Declaration
public static void DisposeAndNull<T>(Span<T?> array) where T : class, IDisposable
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | array | The objects. |
Type Parameters
| Name | Description |
|---|---|
| T | A releasable type. |
DisposeAndNull<T>(ref T?)
Immediately releases the unmanaged resources.
Declaration
public static void DisposeAndNull<T>(ref T? o) where T : class, IDisposable
Parameters
| Type | Name | Description |
|---|---|---|
| T | o | The object. |
Type Parameters
| Name | Description |
|---|---|
| T | A releasable type. |
DisposeAndNull<T>(T?[]?)
Immediately releases the unmanaged resources.
Declaration
public static void DisposeAndNull<T>(T?[]? array) where T : class, IDisposable
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | The objects. |
Type Parameters
| Name | Description |
|---|---|
| T | A releasable type. |
QueryInterface(nint, in Guid)
Query a COM interface.
Declaration
public static nint QueryInterface(nint comPtr, in Guid iid)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | comPtr | The com interface. |
| Guid | iid | The GUID identifier of the interface. |
Returns
| Type | Description |
|---|---|
| nint | The interface pointer. |
Release(nint)
Release a COM object.
Declaration
public static int Release(nint comPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | comPtr | The com interface. |
Returns
| Type | Description |
|---|---|
| int | The reference count. |
StrFormatByteSize(long)
Declaration
public static string StrFormatByteSize(long filesize)
Parameters
| Type | Name | Description |
|---|---|---|
| long | filesize |
Returns
| Type | Description |
|---|---|
| string |
StrFormatByteSize(long, Span<char>)
Declaration
public static void StrFormatByteSize(long filesize, Span<char> buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| long | filesize | |
| Span<char> | buffer |