DevToys logo DevToys
  • Home
  • Blog
  • Documentation
  • Download
Search Results for

    Show / Hide Table of Contents

    Struct SettingDefinition<T>

    Represents the definition of a setting in the application.

    Implements
    IEquatable<SettingDefinition<T>>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: DevToys.Api
    Assembly: DevToys.Api.dll
    Syntax
    public readonly struct SettingDefinition<T> : IEquatable<SettingDefinition<T>>
    Type Parameters
    Name Description
    T

    The type of value of the setting

    Constructors

    SettingDefinition(string, T)

    Initializes a new instance of the SettingDefinition<T> structure.

    Declaration
    public SettingDefinition(string name, T defaultValue)
    Parameters
    Type Name Description
    string name

    The name of the setting. Should be unique.

    T defaultValue

    The default value of the setting.

    SettingDefinition(string, T, Func<T, string>, Func<string, T>)

    Initializes a new instance of the SettingDefinition<T> structure.

    Declaration
    public SettingDefinition(string name, T defaultValue, Func<T, string> serialize, Func<string, T> deserialize)
    Parameters
    Type Name Description
    string name

    The name of the setting. Should be unique.

    T defaultValue

    The default value of the setting.

    Func<T, string> serialize

    A callback that can be used to serialize the value of the setting.

    Func<string, T> deserialize

    A callback that can be used to deserialize the value of the setting.

    Properties

    DefaultValue

    Gets the default value of the setting.

    Declaration
    public T DefaultValue { get; }
    Property Value
    Type Description
    T

    Deserialize

    Gets a callback that can be used to deserialize the value of the setting.

    Declaration
    public Func<string, T>? Deserialize { get; }
    Property Value
    Type Description
    Func<string, T>

    Name

    Gets the name of the setting.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    Serialize

    Gets a callback that can be used to serialize the value of the setting.

    Declaration
    public Func<T, string>? Serialize { get; }
    Property Value
    Type Description
    Func<T, string>

    Methods

    Equals(SettingDefinition<T>)

    Determines whether the specified SettingDefinition<T> is equal to the current SettingDefinition<T>.

    Declaration
    public bool Equals(SettingDefinition<T> other)
    Parameters
    Type Name Description
    SettingDefinition<T> other

    The SettingDefinition<T> to compare with the current SettingDefinition<T>.

    Returns
    Type Description
    bool

    true if the specified SettingDefinition<T> is equal to the current SettingDefinition<T>; otherwise, false.

    Equals(object?)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object? obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

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

    Overrides
    ValueType.Equals(object)

    GetHashCode()

    Returns the hash code for this SettingDefinition<T>.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A 32-bit signed integer hash code.

    Overrides
    ValueType.GetHashCode()

    Operators

    operator ==(SettingDefinition<T>, SettingDefinition<T>)

    Determines whether two specified SettingDefinition<T> objects have the same value.

    Declaration
    public static bool operator ==(SettingDefinition<T> left, SettingDefinition<T> right)
    Parameters
    Type Name Description
    SettingDefinition<T> left

    The first SettingDefinition<T> to compare.

    SettingDefinition<T> right

    The second SettingDefinition<T> to compare.

    Returns
    Type Description
    bool

    true if the value of left is the same as the value of right; otherwise, false.

    operator !=(SettingDefinition<T>, SettingDefinition<T>)

    Determines whether two specified SettingDefinition<T> objects have different values.

    Declaration
    public static bool operator !=(SettingDefinition<T> left, SettingDefinition<T> right)
    Parameters
    Type Name Description
    SettingDefinition<T> left

    The first SettingDefinition<T> to compare.

    SettingDefinition<T> right

    The second SettingDefinition<T> to compare.

    Returns
    Type Description
    bool

    true if the value of left is different from the value of right; otherwise, false.

    Implements

    IEquatable<T>

    Extension Methods

    LoggingExtensions.Log<T>(T)
    In this article
    DevToys logo © 2024 DevToys