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 struct Blob : IEquatable<Blob>

Reference documentation and code samples for the Firestore API struct Blob.

An immutable sequence of bytes.

## Implements

[IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Blob](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob)

## Inherited Members

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

## Namespace

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

## Assembly

Google.Cloud.Firestore.dll

## Remarks

Although this is a struct, it's effectively just a wrapper around a Protobuf ByteString.
`default(Blob)` acts as if it had been constructed with [Empty](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html#Google_Protobuf_ByteString_Empty).

## Properties

### ByteString

    public ByteString ByteString { get; }

The underlying Protobuf ByteString.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` |   |

### this\[int\]

    public byte this[int index] { get; }

Returns the byte at index `index`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://learn.microsoft.com/dotnet/api/system.int32` The index in the blob to return. Must be greater than or equal to 0, and less than [Length](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob#Google_Cloud_Firestore_Blob_Length). |

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.byte` | The byte at index `index`. |

### Length

    public int Length { get; }

The length of the blob, in bytes.

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

## Methods

### CopyFrom(byte\[\])

    public static Blob CopyFrom(byte[] bytes)

Constructs a new [Blob](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob) by copying the current content of `bytes`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `bytes` | `https://learn.microsoft.com/dotnet/api/system.byte` Byte array to copy. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob` | A new blob containing a copy of `bytes`. |

### FromByteString(ByteString)

    public static Blob FromByteString(ByteString byteString)

Constructs a new [Blob](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob) wrapping the given [ByteString](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob#Google_Cloud_Firestore_Blob_ByteString).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `byteString` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ByteString.html` The ByteString to wrap. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob` | A new blob wrapping `byteString`. |

### GetHashCode()

    public override int GetHashCode()

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

**Overrides** [ValueType.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.valuetype.gethashcode)

### ToString()

    public override string ToString()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

**Overrides** [ValueType.ToString()](https://learn.microsoft.com/dotnet/api/system.valuetype.tostring)

## Operators

### operator ==(Blob, Blob)

    public static bool operator ==(Blob lhs, Blob rhs)

Operator overload to compare two Blob values for equality.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `lhs` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob` Left value to compare |
| `rhs` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob` Right value to compare |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | true if `lhs` is equal to `rhs`; otherwise false. |

### operator !=(Blob, Blob)

    public static bool operator !=(Blob lhs, Blob rhs)

Operator overload to compare two Blob values for inequality.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `lhs` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob` Left value to compare |
| `rhs` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Blob` Right value to compare |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` | false if `lhs` is equal to `rhs`; otherwise true. |