Search Results for

Show / Hide Table of Contents

# Struct AffinityKey

Optional wrapper for cache keys to provide support for custom affinity mapping. The value returned by Affinity will be used for key-to-node affinity.

##### Implements

IEquatable<AffinityKey>

###### Namespace: Apache.Ignite.Core.Cache.Affinity

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public struct AffinityKey : IEquatable<AffinityKey>, IBinaryWriteAware

### Constructors

#### AffinityKey(Object)

Initializes a new instance of the AffinityKey struct.

##### Declaration

    public AffinityKey(object key)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | key | The key.

#### AffinityKey(Object, Object)

Initializes a new instance of the AffinityKey struct.

##### Declaration

    public AffinityKey(object key, object affinity)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | key | The key.
System.Object | affinity | The affinity key.

### Properties

#### Affinity

Gets the affinity key.

##### Declaration

    public readonly object Affinity { get; }

##### Property Value

Type | Description
--- | ---
System.Object |

#### Key

Gets the key.

##### Declaration

    public readonly object Key { get; }

##### Property Value

Type | Description
--- | ---
System.Object |

### Methods

#### Equals(AffinityKey)

Indicates whether the current object is equal to another object of the same type.

##### Declaration

    public bool Equals(AffinityKey other)

##### Parameters

Type | Name | Description
--- | --- | ---
AffinityKey | other | An object to compare with this object.

##### Returns

Type | Description
--- | ---
System.Boolean | true if the current object is equal to the `other` parameter; otherwise, false.

#### Equals(Object)

Determines whether the specified , is equal to this instance.

##### Declaration

    public override bool Equals(object obj)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | obj | The to compare with this instance.

##### Returns

Type | Description
--- | ---
System.Boolean | `true` if the specified is equal to this instance; otherwise, `false`.

#### GetHashCode()

Returns a hash code for this instance.

##### Declaration

    public override int GetHashCode()

##### Returns

Type | Description
--- | ---
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

#### ToString()

Returns a that represents this instance.

##### Declaration

    public override string ToString()

##### Returns

Type | Description
--- | ---
System.String | A that represents this instance.

#### WriteBinary(IBinaryWriter)

Writes this object to the given writer.

##### Declaration

    public void WriteBinary(IBinaryWriter writer)

##### Parameters

Type | Name | Description
--- | --- | ---
IBinaryWriter | writer | Writer.

### Operators

#### Equality(AffinityKey, AffinityKey)

Implements the operator ==.

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
AffinityKey | left | The left.
AffinityKey | right | The right.

##### Returns

Type | Description
--- | ---
System.Boolean | The result of the operator.

#### Inequality(AffinityKey, AffinityKey)

Implements the operator !=.

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
AffinityKey | left | The left.
AffinityKey | right | The right.

##### Returns

Type | Description
--- | ---
System.Boolean | The result of the operator.

### Implements

IEquatable<>