.NET Consumer read from end of topic

I have a .NET Consumer and I want it to read always from the end of the topic. AutoOffsetReset.Latest won’t solve this, since the Consumer could reconnect after a disconnect. In that scenario, I don’t want to read the messages that are posted on the topic when the Consumer was disconnected. I want to get only those messages after the subsequent connect after the disconnect.

Is there a code example of how to always read from the end ?

Would it make sense to use the following code for achieving the above goal?

private void SetOffsetToEnd(IConsumer<Ignore, string> consumer, string topic)
{
    List<string> topics = new List<string> { topic };

    consumer.Assign(topics.Select(topic => new TopicPartitionOffset(topic, 0, Offset.End)).ToList());

    var offsets = consumer.Assignment.Select(partition => new TopicPartitionOffset(partition, Offset.End));
    foreach (var offset in offsets)
    {
        consumer.Seek(offset);
    }
}

Yes that code snippet looks reasonable to me for the case where you are manually assigning partitions. If you’re not calling Assign and instead using consumer group management then you could handle the start offset by specifying a partitions assigned handler like this and returning the desired start offsets to be at the end:

.SetPartitionsAssignedHandler((c, partitions) =>
    {
        ...
        return partitions.Select(partition => new TopicPartitionOffset(partition, Offset.End));
    })