Search Results for

    Show / Hide Table of Contents

    Class SerializedNameAttribute

    Specifies a name for the serialized field or property in an object being wrapped by Generated<T>(Config, Boolean) that is different from the member name itself.

    Inheritance
    Object
    SerializedNameAttribute
    Namespace: IPA.Config.Stores.Attributes
    Assembly: IPA.Loader.dll
    Syntax
    public sealed class SerializedNameAttribute : Attribute
    Examples

    When serializing the following object, we might get the JSON that follows.

    public class PluginConfig
    {
        public virtual bool BooleanField { get; set; } = true;
    }
    {
        "BooleanField": true
    }

    However, if we were to add a SerializedNameAttribute to that field, we would get the following.

    public class PluginConfig
    {
        [SerializedName("bool")]
        public virtual bool BooleanField { get; set; } = true;
    }
    {
        "bool": true
    }

    Constructors

    | Improve this Doc View Source

    SerializedNameAttribute(String)

    Creates a new SerializedNameAttribute with the given Name.

    Declaration
    public SerializedNameAttribute(string name)
    Parameters
    Type Name Description
    String name

    the value to assign to Name

    Properties

    | Improve this Doc View Source

    Name

    Gets the name to replace the member name with.

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

    Extension Methods

    ReflectionUtil.SetField<T, U>(T, String, U)
    ReflectionUtil.GetField<U, T>(T, String)
    ReflectionUtil.SetProperty<T, U>(T, String, U)
    ReflectionUtil.GetProperty<U, T>(T, String)
    ReflectionUtil.InvokeMethod<U, T>(T, String, Object[])
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX