4.6.0 (latest) 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.1 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.5.0 2.4.0 2.3.1

    public sealed class Precondition

Reference documentation and code samples for the Firestore API class Precondition.

Immutable class representing a precondition for an update operation.

## Inheritance

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

## 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.Firestore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore)

## Assembly

Google.Cloud.Firestore.dll

## Properties

### Exists

    public bool? Exists { get; }

True if the document must exist; false if the document must not exist.
If this is non-null, [LastUpdateTime](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Precondition#Google_Cloud_Firestore_Precondition_LastUpdateTime) will be null.

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

### LastUpdateTime

    public Timestamp? LastUpdateTime { get; }

Condition that the document was last updated at the specified timestamp, if specified.
If this is non-null, [Exists](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Precondition#Google_Cloud_Firestore_Precondition_Exists) will be null.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Timestamp` |   |

### MustExist

    public static Precondition MustExist { get; }

Precondition that the document must exist, but with any last update time.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Precondition` |   |

### None

    public static Precondition None { get; }

No precondition.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Precondition` |   |

## Methods

### LastUpdated(Timestamp)

    public static Precondition LastUpdated(Timestamp timestamp)

Creates a precondition that the document has the specified last update time.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `timestamp` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Precondition` |   |