> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameRuntimeIsFeatureAvailable

> XGameRuntimeIsFeatureAvailable

# XGameRuntimeIsFeatureAvailable

指示 Gaming Runtime 功能是否可用。

## Syntax

```cpp theme={null}
bool XGameRuntimeIsFeatureAvailable(  
         XGameRuntimeFeature feature  
)  
```

### Parameters

*feature*   \
类型：[XGameRuntimeFeature](/reference/system/xgameruntimefeature/enums/xgameruntimefeature)

要查询的 Gaming Runtime 功能。

### Return value

类型：bool

如果 Gaming Runtime 功能可用，则返回 **true**；否则返回 **false**。

## Remarks

使用 [XGameRuntimeInitialize](/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize) 初始化 Gaming Runtime 之后，使用此函数检查特定的 Gaming Runtime 功能是否可供你的游戏使用。

以下示例使用 **XGameRuntimeIsFeatureAvailable** 函数检查 Async、AsyncProvider 和 TaskQueue 功能是否可用。要使用任务队列运行异步任务，需要这三个功能。

```cpp theme={null}
// Confirm that all of the features needed to run asynchronous tasks on 
// task queues are available.
bool Game::CheckAsyncTaskQueueFeatures()
{
    
    return (XGameRuntimeIsFeatureAvailable(XGameRuntimeFeature::XTaskQueue) &&
        XGameRuntimeIsFeatureAvailable(XGameRuntimeFeature::XAsyncProvider) &&
        XGameRuntimeIsFeatureAvailable(XGameRuntimeFeature::XAsync));

}
```

## Requirements

**头文件：** XGameRuntimeFeature.h

**库：** xgameruntime.lib

**受支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## Conceptual documentation

* [Game Chat 2 简介](/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro)

## See also

[Gaming Runtime 术语表](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/intro/gaming-runtime-glossary)\
[XGameRuntimeFeature 类](/reference/system/xgameruntimefeature/xgameruntimefeature_members)\
[XGameRuntimeFeature 枚举](/reference/system/xgameruntimefeature/enums/xgameruntimefeature)


## Related topics

- [XGameRuntimeFeature](/zh-CN/reference/system/xgameruntimefeature/enums/xgameruntimefeature.md)
- [XGameRuntimeFeature (API contents)](/zh-CN/reference/system/xgameruntimefeature/xgameruntimefeature_members.md)
- [GDK 中的 Windows Sockets 简介](/zh-CN/build/console-features/networking/game-mesh/winsock-intro-networking.md)
- [XSystemRuntimeInfo](/zh-CN/reference/system/xsystem/structs/xsystemruntimeinfo.md)
- [XGameRuntimeInitialize](/zh-CN/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize.md)
