Method TryGetSymbolDelegate
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
librarynintA handle to the native library containing the symbol.
namestringThe name of the symbol to locate in the native library.
Returns
- T
An instance of the delegate of type
Tif the symbol is found; otherwise, null.
Type Parameters
TThe 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.