/// <summary> /// Loads the API for the given extension, using the base API. /// </summary> /// <param name="device">The device of the context.</param> /// <param name="baseAPI">The base API instance.</param> /// <typeparam name="TContextExtension">The extension type.</typeparam> /// <returns>The extension.</returns> /// <exception cref="ExtensionNotSupportedException">Thrown if the API doesn't support the extension.</exception> internal static TContextExtension LoadContextExtension <TContextExtension>(ALContext baseApi) where TContextExtension : NativeExtension <ALContext> { return(baseApi.IsExtensionPresent(ExtensionAttribute.GetExtensionAttribute(typeof(TContextExtension)).Name) ? (TContextExtension)Activator.CreateInstance(typeof(TContextExtension), baseApi.Context) : null); }