Table of Contents

Interface IExtensibleEnum<TSelf>

Namespace
Cloudflare.NET.Core.Json
Assembly
Cloudflare.NET.dll

Defines the contract for an extensible enum type that wraps a string value.

Extensible enums provide strong typing and IntelliSense for known values while allowing custom values to be specified when the API adds new options that the SDK doesn't yet know about.

public interface IExtensibleEnum<TSelf> where TSelf : struct, IExtensibleEnum<TSelf>

Type Parameters

TSelf

The implementing type itself (for static factory method).

Examples

// Using a known value with IntelliSense
var location = R2LocationHint.EastNorthAmerica;

// Using a custom value if API adds new options
R2LocationHint customLocation = "new-region";

Remarks

This pattern is commonly used by cloud SDKs (Azure SDK, AWS SDK) to handle API evolution gracefully.

Implementers should provide static properties for known values and implicit conversion operators for seamless string interoperability.

Properties

Value

Gets the underlying string value of this extensible enum.

string Value { get; }

Property Value

string

Methods

Create(string)

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

public static abstract TSelf Create(string value)

Parameters

value string

The string value to wrap.

Returns

TSelf

A new instance of TSelf containing the specified value.