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
valuestringThe string value representing the subscription frequency.
Exceptions
- ArgumentNullException
Thrown when
valueis null.
Properties
Monthly
Billing occurs every month.
This is the most common billing frequency for Cloudflare subscriptions.
public static SubscriptionFrequency Monthly { get; }
Property Value
Quarterly
Billing occurs every three months.
public static SubscriptionFrequency Quarterly { get; }
Property Value
Value
Gets the underlying string value of this subscription frequency.
public string Value { get; }
Property Value
Weekly
Billing occurs every week.
public static SubscriptionFrequency Weekly { get; }
Property Value
Yearly
Billing occurs once per year.
Annual subscriptions often come with a discount compared to monthly billing.
public static SubscriptionFrequency Yearly { get; }
Property Value
Methods
Create(string)
Creates a new instance of the extensible enum from the specified string value.
public static SubscriptionFrequency Create(string value)
Parameters
valuestringThe 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
otherSubscriptionFrequencyAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
leftSubscriptionFrequencyrightSubscriptionFrequency
Returns
implicit operator string(SubscriptionFrequency)
Implicitly converts a SubscriptionFrequency to its string value.
public static implicit operator string(SubscriptionFrequency frequency)
Parameters
frequencySubscriptionFrequencyThe subscription frequency to convert.
Returns
implicit operator SubscriptionFrequency(string)
Implicitly converts a string to a SubscriptionFrequency.
public static implicit operator SubscriptionFrequency(string value)
Parameters
valuestringThe string value to convert.
Returns
operator !=(SubscriptionFrequency, SubscriptionFrequency)
Determines whether two SubscriptionFrequency values are not equal.
public static bool operator !=(SubscriptionFrequency left, SubscriptionFrequency right)
Parameters
leftSubscriptionFrequencyrightSubscriptionFrequency