Project

DnsClientX

DnsClientX is an async C# library for DNS over UDP, TCP, HTTPS (DoH), and TLS (DoT). It also has a PowerShell module that can be used to query DNS records. It provides a simple way to query DNS records using multiple DNS providers. It supports multiple DNS record types and parallel queries.

Stars23
Forks3
Open issues2
PowerShell Gallery downloads51564
ReleaseDnsClientX-PowerShellModule.v1.0.5
Language: C# Updated: 2026-05-04T15:07:37.0000000+00:00

Curated Examples

Use typed records in .NET

Read DNS query results as typed .NET record objects.

This pattern is useful when application code needs structured DNS data instead of raw strings.

It is adapted from DnsClientX.Examples/DemoTypedRecords.cs.

Example

using DnsClientX;

using var client = new ClientX(DnsEndpoint.Cloudflare);
var response = await client.Resolve("example.com", DnsRecordType.A, typedRecords: true);

foreach (var record in response.TypedAnswers ?? [])
{
    Console.WriteLine(record);
}

What this demonstrates

  • using the .NET client directly
  • enabling typed records for safer downstream processing
  • keeping the example independent of private zones

Source