confluent-kafka-dotnet
Show / Hide Table of Contents

Class TopicPartition

Represents a Kafka (topic, partition) tuple.

Inheritance
object
TopicPartition
Implements
IComparable
Inherited Members
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Confluent.Kafka
Assembly: Confluent.Kafka.dll
Syntax
public class TopicPartition : IComparable

Constructors

TopicPartition(string, Partition)

Initializes a new TopicPartition instance.

Declaration
public TopicPartition(string topic, Partition partition)
Parameters
TypeNameDescription
stringtopic

A Kafka topic name.

Partitionpartition

A Kafka partition.

Properties

Partition

Gets the Kafka partition.

Declaration
public Partition Partition { get; }
Property Value
TypeDescription
Partition

Topic

Gets the Kafka topic name.

Declaration
public string Topic { get; }
Property Value
TypeDescription
string

Methods

CompareTo(object)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Declaration
public int CompareTo(object obj)
Parameters
TypeNameDescription
objectobj
Returns
TypeDescription
int

Less than zero: This instance precedes obj in the sort order. Zero: This instance occurs in the same position in the sort order as obj. Greater than zero: This instance follows obj in the sort order.

Equals(object)

Tests whether this TopicPartition instance is equal to the specified object.

Declaration
public override bool Equals(object obj)
Parameters
TypeNameDescription
objectobj

The object to test.

Returns
TypeDescription
bool

true if obj is a TopicPartition and all properties are equal. false otherwise.

Overrides
object.Equals(object)

GetHashCode()

Returns a hash code for this TopicPartition.

Declaration
public override int GetHashCode()
Returns
TypeDescription
int

An integer that specifies a hash value for this TopicPartition.

Overrides
object.GetHashCode()

ToString()

Returns a string representation of the TopicPartition object.

Declaration
public override string ToString()
Returns
TypeDescription
string

A string that represents the TopicPartition object.

Overrides
object.ToString()

Operators

operator ==(TopicPartition, TopicPartition)

Tests whether TopicPartition instance a is equal to TopicPartition instance b.

Declaration
public static bool operator ==(TopicPartition a, TopicPartition b)
Parameters
TypeNameDescription
TopicPartitiona

The first TopicPartition instance to compare.

TopicPartitionb

The second TopicPartition instance to compare.

Returns
TypeDescription
bool

true if TopicPartition instances a and b are equal. false otherwise.

operator !=(TopicPartition, TopicPartition)

Tests whether TopicPartition instance a is not equal to TopicPartition instance b.

Declaration
public static bool operator !=(TopicPartition a, TopicPartition b)
Parameters
TypeNameDescription
TopicPartitiona

The first TopicPartition instance to compare.

TopicPartitionb

The second TopicPartition instance to compare.

Returns
TypeDescription
bool

true if TopicPartition instances a and b are not equal. false otherwise.

Implements

IComparable
In this article