Struct Blob (2.4.0)

public struct Blob : IEquatable<Blob>

An immutable sequence of bytes.

Implements

IEquatable<Blob>

Namespace

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.

Properties

ByteString

public ByteString ByteString { get; }

The underlying Protobuf ByteString.

Property Value
TypeDescription
ByteString

Item[Int32]

public byte this[int index] { get; }

Returns the byte at index index.

Parameter
NameDescription
indexInt32

The index in the blob to return. Must be greater than or equal to 0, and less than Length.

Property Value
TypeDescription
Byte

The byte at index index.

Length

public int Length { get; }

The length of the blob, in bytes.

Property Value
TypeDescription
Int32

Methods

CopyFrom(Byte[])

public static Blob CopyFrom(byte[] bytes)

Constructs a new Blob by copying the current content of bytes.

Parameter
NameDescription
bytesByte[]

Byte array to copy.

Returns
TypeDescription
Blob

A new blob containing a copy of bytes.

FromByteString(ByteString)

public static Blob FromByteString(ByteString byteString)

Constructs a new Blob wrapping the given ByteString.

Parameter
NameDescription
byteStringByteString

The ByteString to wrap. Must not be null.

Returns
TypeDescription
Blob

A new blob wrapping byteString.

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32
Overrides

ToString()

public override string ToString()
Returns
TypeDescription
String
Overrides

Operators

Equality(Blob, Blob)

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

Operator overload to compare two Blob values for equality.

Parameters
NameDescription
lhsBlob

Left value to compare

rhsBlob

Right value to compare

Returns
TypeDescription
Boolean

true if lhs is equal to rhs; otherwise false.

Inequality(Blob, Blob)

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

Operator overload to compare two Blob values for inequality.

Parameters
NameDescription
lhsBlob

Left value to compare

rhsBlob

Right value to compare

Returns
TypeDescription
Boolean

false if lhs is equal to rhs; otherwise true.