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
Attribute
SerializedNameAttribute

##### Implements

_Attribute

##### Inherited Members

Attribute.GetCustomAttributes(MemberInfo, Type)
Attribute.GetCustomAttributes(MemberInfo, Type, Boolean)
Attribute.GetCustomAttributes(MemberInfo)
Attribute.GetCustomAttributes(MemberInfo, Boolean)
Attribute.IsDefined(MemberInfo, Type)
Attribute.IsDefined(MemberInfo, Type, Boolean)
Attribute.GetCustomAttribute(MemberInfo, Type)
Attribute.GetCustomAttribute(MemberInfo, Type, Boolean)
Attribute.GetCustomAttributes(ParameterInfo)
Attribute.GetCustomAttributes(ParameterInfo, Type)
Attribute.GetCustomAttributes(ParameterInfo, Type, Boolean)
Attribute.GetCustomAttributes(ParameterInfo, Boolean)
Attribute.IsDefined(ParameterInfo, Type)
Attribute.IsDefined(ParameterInfo, Type, Boolean)
Attribute.GetCustomAttribute(ParameterInfo, Type)
Attribute.GetCustomAttribute(ParameterInfo, Type, Boolean)
Attribute.GetCustomAttributes(Module, Type)
Attribute.GetCustomAttributes(Module)
Attribute.GetCustomAttributes(Module, Boolean)
Attribute.GetCustomAttributes(Module, Type, Boolean)
Attribute.IsDefined(Module, Type)
Attribute.IsDefined(Module, Type, Boolean)
Attribute.GetCustomAttribute(Module, Type)
Attribute.GetCustomAttribute(Module, Type, Boolean)
Attribute.GetCustomAttributes(Assembly, Type)
Attribute.GetCustomAttributes(Assembly, Type, Boolean)
Attribute.GetCustomAttributes(Assembly)
Attribute.GetCustomAttributes(Assembly, Boolean)
Attribute.IsDefined(Assembly, Type)
Attribute.IsDefined(Assembly, Type, Boolean)
Attribute.GetCustomAttribute(Assembly, Type)
Attribute.GetCustomAttribute(Assembly, Type, Boolean)
Attribute.Equals(Object)
Attribute.GetHashCode()
Attribute.Match(Object)
Attribute.IsDefaultAttribute()
Attribute._Attribute.GetTypeInfoCount(UInt32)
Attribute._Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
Attribute._Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
Attribute._Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
Attribute.TypeId
Object.ToString()
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Object.MemberwiseClone()

###### Namespace: IPA.Config.Stores.Attributes

###### Assembly: IPA.Loader.dll

##### Syntax

    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
    public sealed class SerializedNameAttribute : Attribute, _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 |

### Implements

System.Runtime.InteropServices._Attribute

### 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[])