Table of Contents

Struct PartitionKey

Namespace
Microsoft.Azure.Cosmos
Assembly
Microsoft.Azure.Cosmos.Client.dll

Represents a partition key value in the Azure Cosmos DB service.

public readonly struct PartitionKey : IEquatable<PartitionKey>
Implements
Inherited Members
Extension Methods

Constructors

PartitionKey(bool)

Creates a new partition key value.

public PartitionKey(bool partitionKeyValue)

Parameters

partitionKeyValue bool

The value to use as partition key.

PartitionKey(double)

Creates a new partition key value.

public PartitionKey(double partitionKeyValue)

Parameters

partitionKeyValue double

The value to use as partition key.

PartitionKey(string)

Creates a new partition key value.

public PartitionKey(string partitionKeyValue)

Parameters

partitionKeyValue string

The value to use as partition key.

Fields

None

The returned object represents a partition key value that allows creating and accessing items without a value for partition key.

public static readonly PartitionKey None

Field Value

PartitionKey

Null

The returned object represents a partition key value that allows creating and accessing items with a null value for the partition key.

public static readonly PartitionKey Null

Field Value

PartitionKey

SystemKeyName

The tag name to use in the documents for specifying a partition key value when inserting such documents into a migrated collection

public static readonly string SystemKeyName

Field Value

string

SystemKeyPath

The partition key path in the collection definition for migrated collections

public static readonly string SystemKeyPath

Field Value

string

Methods

Equals(PartitionKey)

Returns a value indicating whether this instance is equal to a specified partition key.

public bool Equals(PartitionKey other)

Parameters

other PartitionKey

A partition key value to compare to this instance.

Returns

bool

true if other has the same value as this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

An object to compare.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Returns the hash code for this partition key.

public override int GetHashCode()

Returns

int

A 32-bit signed integer hash code.

ToString()

Gets the string representation of the partition key value.

public override string ToString()

Returns

string

The string representation of the partition key value

Operators

operator ==(PartitionKey, PartitionKey)

Determines whether two specified instances of the PartitionKey are equal.

public static bool operator ==(PartitionKey left, PartitionKey right)

Parameters

left PartitionKey

The first object to compare.

right PartitionKey

The second object to compare.

Returns

bool

true if left and right represent the same partition key; otherwise, false.

operator !=(PartitionKey, PartitionKey)

Determines whether two specified instances of the PartitionKey are not equal.

public static bool operator !=(PartitionKey left, PartitionKey right)

Parameters

left PartitionKey

The first object to compare.

right PartitionKey

The second object to compare.

Returns

bool

true if left and right do not represent the same partition key; otherwise, false.