# LabelSelectorV1

- Kind: `class`
- Package: [Aspire.Hosting.Kubernetes](/reference/api/csharp/aspire.hosting.kubernetes.md)
- Version: `13.3.0-preview.1.26254.5`
- Namespace: `Aspire.Hosting.Kubernetes.Resources`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/LabelSelectorV1.cs)

Represents a label selector for Kubernetes resources. A label selector is used to filter resources based on their labels, enabling selection of a specific set of objects in a dynamic way.

## Definition

```csharp
namespace Aspire.Hosting.Kubernetes.Resources;

public sealed class LabelSelectorV1
{
    // ...
}
```

## Remarks

The selector can contain two key components: - MatchLabels: A dictionary of key-value pairs where the resource labels must match exactly. - MatchExpressions: A list of label selector requirements that allow more complex filtering rules.

## Constructors

- [LabelSelectorV1](/reference/api/csharp/aspire.hosting.kubernetes/labelselectorv1/constructors.md#constructor) -- Represents a label selector used to determine a set of resources in Kubernetes that match the defined criteria.
- [LabelSelectorV1(Dictionary<string, string>)](/reference/api/csharp/aspire.hosting.kubernetes/labelselectorv1/constructors.md#constructor-dictionary-string-string) -- Represents a label selector used to determine a set of resources in Kubernetes that match the defined criteria.

## Properties

- [MatchExpressions](/reference/api/csharp/aspire.hosting.kubernetes/labelselectorv1/properties.md#matchexpressions) : [List<LabelSelectorRequirementV1>](/reference/api/csharp/aspire.hosting.kubernetes/labelselectorrequirementv1.md) `get; set` -- Represents a collection of label selector requirements used for matching Kubernetes resources. Each requirement specifies a key, an operator, and a set of values to define filtering criteria. This property is used to form more complex selection logic based on multiple conditions.
- [MatchLabels](/reference/api/csharp/aspire.hosting.kubernetes/labelselectorv1/properties.md#matchlabels) : `Dictionary<string, string>` `get; set` -- A collection of key-value pairs used to specify matching labels for Kubernetes resources. Labels are utilized as selectors to filter or identify a subset of resources within a Kubernetes environment.
