# AvroConsumer C# equivalent?

**URL:** <https://forum.confluent.io/t/avroconsumer-c-equivalent/8730>\
**Category:** Clients\
**Created:** [19 September 2023 17:51 UTC](https://forum.confluent.io/t/avroconsumer-c-equivalent/8730 "2023-09-19T17:51:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amosbeck](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@amosbeck](https://forum.confluent.io/u/amosbeck)\
**Post date:** [19 September 2023 17:51 UTC](https://forum.confluent.io/t/avroconsumer-c-equivalent/8730/1 "2023-09-19T17:51:41Z")

</div>

First, I’m new to this so please forgive me if I use terminology incorrectly.

I’m using .NET (C#) to consume messages from a Kafka topic. The messages are originating from a Python producer that uses the (deprecated) AvroProducer class. The producer is using the schema registry so I need to consume and deserialize the message with that schema registry. I can do this in Python very easily and successfully using the (deprecated) AvroConsumer. I’m looking for the same functionality for .NET. Specifically, I want the JSON output of the json.dumps() method below but I need to do this in C#.

Can anybody point me in the right direction?

import json  
from confluent\_kafka import KafkaException  
from confluent\_kafka.avro import AvroConsumer

consumer\_config = {  
‘bootstrap.servers’: ‘[our bootstrap servers]’,  
‘schema.registry.url’: ‘[our schema registry]’,  
‘group.id’: ‘[my group id]’,  
‘auto.offset.reset’: ‘earliest’  
}

count = 1  
consumer = AvroConsumer(consumer\_config)  
consumer.subscribe([‘[specific topic]’])

# consume 10 messages

while count \< 10:  
try:  
msg = ‘’  
msg = consumer.poll(1)  
if msg is None:  
continue  
count=count+1  
print('Value: ’ + json.dumps(msg.value()))  
except KafkaException as e:  
print('Kafka failure: ’ + e)

consumer.close()
