#### [Abblix\.Utils](https://www.abblix.com/en/docs/api/abblix-utils 'index')
### [Abblix\.Utils\.Validation](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Validation 'Abblix\.Utils\.Validation')

## AllowedValuesAttribute Class

A validation attribute that restricts a string \(or string\-collection\) value to a fixed set, matched exactly\.
An absent value passes: whether a member is required is a separate question, asked by a separate attribute,
which is why the framework's own `AllowedValues` cannot stand in for this one \- it refuses null\.
Shared by the MVC and Minimal API OIDC server adapters, whose source generators emit it onto a generated model
whenever the corresponding core property carries the declarative `AllowedValues` marker\.

```csharp
public class AllowedValuesAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → [System\.Attribute](https://learn.microsoft.com/en-us/dotnet/api/system.attribute 'System\.Attribute') → [System\.ComponentModel\.DataAnnotations\.ValidationAttribute](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.validationattribute 'System\.ComponentModel\.DataAnnotations\.ValidationAttribute') → AllowedValuesAttribute
### Constructors

## AllowedValuesAttribute\(string\[\]\) Constructor {#Abblix.Utils.Validation.AllowedValuesAttribute.AllowedValuesAttribute(string[])}

A validation attribute that restricts a string \(or string\-collection\) value to a fixed set, matched exactly\.
An absent value passes: whether a member is required is a separate question, asked by a separate attribute,
which is why the framework's own `AllowedValues` cannot stand in for this one \- it refuses null\.
Shared by the MVC and Minimal API OIDC server adapters, whose source generators emit it onto a generated model
whenever the corresponding core property carries the declarative `AllowedValues` marker\.

```csharp
public AllowedValuesAttribute(params string[] allowedValues);
```
#### Parameters

<a id="Abblix.Utils.Validation.AllowedValuesAttribute.AllowedValuesAttribute(string[]).allowedValues"></a>

`allowedValues` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')
