Table of Contents

Method TryGetSymbolDelegate

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

TryGetSymbolDelegate<T>(nint, string)

Attempts to retrieve a delegate of the specified type for a symbol in a native library.

public static T TryGetSymbolDelegate<T>(nint library, string name) where T : Delegate

Parameters

library nint

A handle to the native library containing the symbol.

name string

The name of the symbol to locate in the native library.

Returns

T

An instance of the delegate of type T if the symbol is found; otherwise, null.

Type Parameters

T

The type of the delegate to retrieve. Must inherit from Delegate.

Remarks

This method uses GetDelegateForFunctionPointer<TDelegate>(nint) to create the delegate. Ensure that the delegate type matches the signature of the native function to avoid runtime errors.