Table of Contents

Struct DnsRecordType

Namespace
Cloudflare.NET.Dns.Models
Assembly
Cloudflare.NET.dll

Represents a DNS record type supported by Cloudflare.

DNS record types define the type of data stored in a DNS record, such as IP addresses (A/AAAA), mail servers (MX), or canonical names (CNAME).

[JsonConverter(typeof(ExtensibleEnumConverter<DnsRecordType>))]
public readonly struct DnsRecordType : IExtensibleEnum<DnsRecordType>, IEquatable<DnsRecordType>
Implements
Inherited Members

Examples

// Using a known record type with IntelliSense
var type = DnsRecordType.CNAME;

// Creating a DNS record request
var request = new CreateDnsRecordRequest(DnsRecordType.A, "example.com", "192.0.2.1", 3600, true);

// Using implicit conversion from string
DnsRecordType customType = "NEW_RECORD_TYPE";

Remarks

This is an extensible enum that provides IntelliSense for known values while allowing custom values for new record types that may be added to the Cloudflare API in the future.

Use the static properties for known record types (e.g., A, CNAME) or create custom values using the constructor or implicit string conversion.

Constructors

DnsRecordType(string)

Creates a new DnsRecordType with the specified value.

public DnsRecordType(string value)

Parameters

value string

The string value representing the record type.

Exceptions

ArgumentNullException

Thrown when value is null.

Properties

A

A record - maps a hostname to an IPv4 address.

public static DnsRecordType A { get; }

Property Value

DnsRecordType

Remarks

The most common DNS record type for pointing domains to servers.

AAAA

AAAA record - maps a hostname to an IPv6 address.

public static DnsRecordType AAAA { get; }

Property Value

DnsRecordType

Remarks

The IPv6 equivalent of an A record.

CAA

CAA record - specifies which Certificate Authorities can issue certificates.

public static DnsRecordType CAA { get; }

Property Value

DnsRecordType

Remarks

Helps prevent unauthorized certificate issuance.

CERT

CERT record - stores certificates in DNS.

public static DnsRecordType CERT { get; }

Property Value

DnsRecordType

Remarks

Can store various types of certificates including X.509 and PGP.

CNAME

CNAME record - creates an alias from one hostname to another.

public static DnsRecordType CNAME { get; }

Property Value

DnsRecordType

Remarks

Useful for pointing subdomains to other domains or services.

DNSKEY

DNSKEY record - contains the public key for DNSSEC.

public static DnsRecordType DNSKEY { get; }

Property Value

DnsRecordType

Remarks

Used by resolvers to verify DNSSEC signatures.

DS

DS record - Delegation Signer record for DNSSEC.

public static DnsRecordType DS { get; }

Property Value

DnsRecordType

Remarks

Used to establish chains of trust in DNSSEC.

HTTPS

HTTPS record - provides connection information for HTTPS services.

public static DnsRecordType HTTPS { get; }

Property Value

DnsRecordType

Remarks

Enables clients to learn about HTTPS alternative services.

MX

MX record - specifies mail servers for the domain.

public static DnsRecordType MX { get; }

Property Value

DnsRecordType

Remarks

Used to route email to the correct mail servers.

NAPTR

NAPTR record - naming authority pointer for URI resolution.

public static DnsRecordType NAPTR { get; }

Property Value

DnsRecordType

Remarks

Used in ENUM and SIP applications.

NS

NS record - specifies authoritative nameservers for the domain.

public static DnsRecordType NS { get; }

Property Value

DnsRecordType

Remarks

Delegates DNS resolution to specific nameservers.

PTR

PTR record - maps an IP address to a hostname (reverse DNS).

public static DnsRecordType PTR { get; }

Property Value

DnsRecordType

Remarks

Used for reverse DNS lookups.

SMIMEA

SMIMEA record - S/MIME certificate association.

public static DnsRecordType SMIMEA { get; }

Property Value

DnsRecordType

Remarks

Associates S/MIME certificates with email addresses.

SOA

SOA record - contains administrative information about the zone.

public static DnsRecordType SOA { get; }

Property Value

DnsRecordType

Remarks

Every DNS zone must have exactly one SOA record.

SRV

SRV record - specifies a host and port for specific services.

public static DnsRecordType SRV { get; }

Property Value

DnsRecordType

Remarks

Used for services like VoIP, instant messaging, and other protocols.

SSHFP

SSHFP record - SSH public key fingerprint.

public static DnsRecordType SSHFP { get; }

Property Value

DnsRecordType

Remarks

Allows SSH clients to verify server host keys via DNS.

SVCB

SVCB record - general service binding record.

public static DnsRecordType SVCB { get; }

Property Value

DnsRecordType

Remarks

The generic version of HTTPS records for other protocols.

TLSA

TLSA record - DANE certificate association.

public static DnsRecordType TLSA { get; }

Property Value

DnsRecordType

Remarks

Associates TLS server certificates with domain names.

TXT

TXT record - holds arbitrary text data.

public static DnsRecordType TXT { get; }

Property Value

DnsRecordType

Remarks

Commonly used for domain verification, SPF, DKIM, and DMARC records.

URI

URI record - publishes mappings from hostnames to URIs.

public static DnsRecordType URI { get; }

Property Value

DnsRecordType

Value

Gets the underlying string value of this record type.

public string Value { get; }

Property Value

string

Methods

Create(string)

Creates a new instance of the extensible enum from the specified string value.

public static DnsRecordType Create(string value)

Parameters

value string

The string value to wrap.

Returns

DnsRecordType

A new instance of DnsRecordType containing the specified value.

Equals(DnsRecordType)

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

public bool Equals(DnsRecordType other)

Parameters

other DnsRecordType

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(DnsRecordType, DnsRecordType)

Determines whether two DnsRecordType values are equal.

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

Parameters

left DnsRecordType
right DnsRecordType

Returns

bool

implicit operator string(DnsRecordType)

Implicitly converts a DnsRecordType to its string value.

public static implicit operator string(DnsRecordType recordType)

Parameters

recordType DnsRecordType

The record type to convert.

Returns

string

implicit operator DnsRecordType(string)

Implicitly converts a string to a DnsRecordType.

public static implicit operator DnsRecordType(string value)

Parameters

value string

The string value to convert.

Returns

DnsRecordType

operator !=(DnsRecordType, DnsRecordType)

Determines whether two DnsRecordType values are not equal.

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

Parameters

left DnsRecordType
right DnsRecordType

Returns

bool

See Also