Table of Contents

Struct SubscriptionFrequency

Namespace
Cloudflare.NET.Subscriptions.Models
Assembly
Cloudflare.NET.dll

Represents the billing frequency of a subscription.

Subscription frequencies define how often billing occurs:

  • WeeklyBilling occurs every week
  • MonthlyBilling occurs every month
  • QuarterlyBilling occurs every three months
  • YearlyBilling occurs once per year
[JsonConverter(typeof(ExtensibleEnumConverter<SubscriptionFrequency>))]
public readonly struct SubscriptionFrequency : IExtensibleEnum<SubscriptionFrequency>, IEquatable<SubscriptionFrequency>
Implements
Inherited Members

Examples

// Using a known frequency with IntelliSense
var frequency = SubscriptionFrequency.Monthly;

// Checking subscription frequency
if (subscription.Frequency == SubscriptionFrequency.Yearly) { ... }

// Using implicit conversion from string
SubscriptionFrequency customFrequency = "biannual";

Remarks

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

Constructors

SubscriptionFrequency(string)

Creates a new SubscriptionFrequency with the specified value.

public SubscriptionFrequency(string value)

Parameters

value string

The string value representing the subscription frequency.

Exceptions

ArgumentNullException

Thrown when value is null.

Properties

Monthly

Billing occurs every month.

This is the most common billing frequency for Cloudflare subscriptions.

public static SubscriptionFrequency Monthly { get; }

Property Value

SubscriptionFrequency

Quarterly

Billing occurs every three months.

public static SubscriptionFrequency Quarterly { get; }

Property Value

SubscriptionFrequency

Value

Gets the underlying string value of this subscription frequency.

public string Value { get; }

Property Value

string

Weekly

Billing occurs every week.

public static SubscriptionFrequency Weekly { get; }

Property Value

SubscriptionFrequency

Yearly

Billing occurs once per year.

Annual subscriptions often come with a discount compared to monthly billing.

public static SubscriptionFrequency Yearly { get; }

Property Value

SubscriptionFrequency

Methods

Create(string)

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

public static SubscriptionFrequency Create(string value)

Parameters

value string

The string value to wrap.

Returns

SubscriptionFrequency

A new instance of SubscriptionFrequency containing the specified value.

Equals(SubscriptionFrequency)

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

public bool Equals(SubscriptionFrequency other)

Parameters

other SubscriptionFrequency

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 ==(SubscriptionFrequency, SubscriptionFrequency)

Determines whether two SubscriptionFrequency values are equal.

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

Parameters

left SubscriptionFrequency
right SubscriptionFrequency

Returns

bool

implicit operator string(SubscriptionFrequency)

Implicitly converts a SubscriptionFrequency to its string value.

public static implicit operator string(SubscriptionFrequency frequency)

Parameters

frequency SubscriptionFrequency

The subscription frequency to convert.

Returns

string

implicit operator SubscriptionFrequency(string)

Implicitly converts a string to a SubscriptionFrequency.

public static implicit operator SubscriptionFrequency(string value)

Parameters

value string

The string value to convert.

Returns

SubscriptionFrequency

operator !=(SubscriptionFrequency, SubscriptionFrequency)

Determines whether two SubscriptionFrequency values are not equal.

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

Parameters

left SubscriptionFrequency
right SubscriptionFrequency

Returns

bool