# Artifact Registry v1 API - Class CleanupPolicyMostRecentVersions (2.15.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.15.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/latest/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.14.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.14.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.13.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.13.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.12.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.12.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.11.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.11.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.10.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.10.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.9.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.9.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.8.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.7.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.7.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.6.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.5.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.4.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.3.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.2.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.1.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [2.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/2.0.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/1.1.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/1.0.0/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions)

    public sealed class CleanupPolicyMostRecentVersions : IMessage<CleanupPolicyMostRecentVersions>, IEquatable<CleanupPolicyMostRecentVersions>, IDeepCloneable<CleanupPolicyMostRecentVersions>, IBufferMessage, IMessage

Reference documentation and code samples for the Artifact Registry v1 API class CleanupPolicyMostRecentVersions.

CleanupPolicyMostRecentVersions is an alternate condition of a CleanupPolicy
for retaining a minimum number of versions.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> CleanupPolicyMostRecentVersions

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CleanupPolicyMostRecentVersions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/latest/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CleanupPolicyMostRecentVersions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/latest/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[CleanupPolicyMostRecentVersions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/latest/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.ArtifactRegistry.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/latest/Google.Cloud.ArtifactRegistry.V1)

## Assembly

Google.Cloud.ArtifactRegistry.V1.dll

## Constructors

### CleanupPolicyMostRecentVersions()

    public CleanupPolicyMostRecentVersions()

### CleanupPolicyMostRecentVersions(CleanupPolicyMostRecentVersions)

    public CleanupPolicyMostRecentVersions(CleanupPolicyMostRecentVersions other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ArtifactRegistry.V1/latest/Google.Cloud.ArtifactRegistry.V1.CleanupPolicyMostRecentVersions` |

## Properties

### HasKeepCount

    public bool HasKeepCount { get; }

Gets whether the "keep_count" field is set

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### KeepCount

    public int KeepCount { get; set; }

Minimum number of versions to keep.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### PackageNamePrefixes

    public RepeatedField<string> PackageNamePrefixes { get; }

List of package name prefixes that will apply this rule.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |