# Views

## Import feature flag helpers globally

In your `_ViewImports.cshtml` add the following line

```cshtml
@addTagHelper *, Microsoft.FeatureManagement.AspNetCore
```

Anywhere in your views you can now surround the parts of the page that make up the feature

```cshtml
<feature name="FeatureX">
    <p>This can only be seen if 'FeatureX' is enabled.</p>
</feature>
```

or add display the contents conditionally if `Any` or `All` the referenced features are enabled

```cshtml
<feature name="ShoppingCart,Checkout,Donation" requirement="Any">
    <div>checkout logic</div>
</feature>
```

{% hint style="info" %}
It's good practice to create a static class or strings or an enum for your features collection to avoid typos. Feature flags in C# work with both strings and enums
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.toggly.io/feature-flags/feature-flags-in-c-.net/views.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
