You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
12 KiB

  1. <!DOCTYPE html>
  2. <!--[if IE]><![endif]-->
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <title>Class SerializedNameAttribute
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class SerializedNameAttribute
  11. ">
  12. <meta name="generator" content="docfx 2.59.3.0">
  13. <link rel="shortcut icon" href="../favicon.ico">
  14. <link rel="stylesheet" href="../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../styles/docfx.css">
  16. <link rel="stylesheet" href="../styles/main.css">
  17. <link rel="stylesheet" href="../styles/fix.css">
  18. <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  19. <meta property="docfx:navrel" content="../toc.html">
  20. <meta property="docfx:tocrel" content="toc.html">
  21. <meta property="docfx:rel" content="../">
  22. <meta property="docfx:newtab" content="true">
  23. </head> <body data-spy="scroll" data-target="#affix" data-offset="120">
  24. <div id="wrapper">
  25. <header>
  26. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  27. <div class="container">
  28. <div class="navbar-header">
  29. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  30. <span class="sr-only">Toggle navigation</span>
  31. <span class="icon-bar"></span>
  32. <span class="icon-bar"></span>
  33. <span class="icon-bar"></span>
  34. </button>
  35. <a class="navbar-brand" href="../index.html">
  36. <img id="logo" class="svg" src="../logo.svg" alt="">
  37. </a>
  38. </div>
  39. <div class="collapse navbar-collapse" id="navbar">
  40. <form class="navbar-form navbar-right" role="search" id="search">
  41. <div class="form-group">
  42. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  43. </div>
  44. </form>
  45. </div>
  46. </div>
  47. </nav>
  48. <div class="subnav navbar navbar-default">
  49. <div class="container hide-when-search" id="breadcrumb">
  50. <ul class="breadcrumb">
  51. <li></li>
  52. </ul>
  53. </div>
  54. </div>
  55. </header>
  56. <div class="container body-content">
  57. <div id="search-results">
  58. <div class="search-list">Search Results for <span></span></div>
  59. <div class="sr-items">
  60. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  61. </div>
  62. <ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
  63. </div>
  64. </div>
  65. <div role="main" class="container body-content hide-when-search">
  66. <div class="sidenav hide-when-search">
  67. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  68. <div class="sidetoggle collapse" id="sidetoggle">
  69. <div id="sidetoc"></div>
  70. </div>
  71. </div>
  72. <div class="article row grid-right">
  73. <div class="col-md-10">
  74. <article class="content wrap" id="_content" data-uid="IPA.Config.Stores.Attributes.SerializedNameAttribute">
  75. <h1 id="IPA_Config_Stores_Attributes_SerializedNameAttribute" data-uid="IPA.Config.Stores.Attributes.SerializedNameAttribute" class="text-break">Class SerializedNameAttribute
  76. </h1>
  77. <div class="markdown level0 summary"><p>Specifies a name for the serialized field or property in an object being wrapped by
  78. <a class="xref" href="IPA.Config.Stores.GeneratedStore.html#IPA_Config_Stores_GeneratedStore_Generated__1_IPA_Config_Config_System_Boolean_">Generated&lt;T&gt;(Config, Boolean)</a> that is different from the member name itself.</p>
  79. </div>
  80. <div class="markdown level0 conceptual"></div>
  81. <div class="inheritance">
  82. <h5>Inheritance</h5>
  83. <div class="level0"><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></div>
  84. <div class="level1"><span class="xref">SerializedNameAttribute</span></div>
  85. </div>
  86. <h6><strong>Namespace</strong>: <a class="xref" href="IPA.Config.Stores.Attributes.html">IPA.Config.Stores.Attributes</a></h6>
  87. <h6><strong>Assembly</strong>: IPA.Loader.dll</h6>
  88. <h5 id="IPA_Config_Stores_Attributes_SerializedNameAttribute_syntax">Syntax</h5>
  89. <div class="codewrapper">
  90. <pre><code class="lang-csharp hljs">public sealed class SerializedNameAttribute : Attribute</code></pre>
  91. </div>
  92. <h5 id="IPA_Config_Stores_Attributes_SerializedNameAttribute_examples"><strong>Examples</strong></h5>
  93. <p>
  94. When serializing the following object, we might get the JSON that follows.
  95. <pre><code>public class PluginConfig
  96. {
  97. public virtual bool BooleanField { get; set; } = true;
  98. }</code></pre>
  99. <pre><code>{
  100. &quot;BooleanField&quot;: true
  101. }</code></pre>
  102. </p>
  103. <p>
  104. However, if we were to add a <a class="xref" href="IPA.Config.Stores.Attributes.SerializedNameAttribute.html">SerializedNameAttribute</a> to that field, we would get the following.
  105. <pre><code>public class PluginConfig
  106. {
  107. [SerializedName(&quot;bool&quot;)]
  108. public virtual bool BooleanField { get; set; } = true;
  109. }</code></pre>
  110. <pre><code>{
  111. &quot;bool&quot;: true
  112. }</code></pre>
  113. </p>
  114. <h3 id="constructors">Constructors
  115. </h3>
  116. <span class="small pull-right mobile-hide">
  117. <span class="divider">|</span>
  118. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Config_Stores_Attributes_SerializedNameAttribute__ctor_System_String_.md&amp;value=---%0Auid%3A%20IPA.Config.Stores.Attributes.SerializedNameAttribute.%23ctor(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  119. </span>
  120. <span class="small pull-right mobile-hide">
  121. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/c326c0dc0fbb51050db23b7b892a9528f5ef3ef0/IPA.Loader/Config/Stores/Attributes.cs/#L143">View Source</a>
  122. </span>
  123. <a id="IPA_Config_Stores_Attributes_SerializedNameAttribute__ctor_" data-uid="IPA.Config.Stores.Attributes.SerializedNameAttribute.#ctor*"></a>
  124. <h4 id="IPA_Config_Stores_Attributes_SerializedNameAttribute__ctor_System_String_" data-uid="IPA.Config.Stores.Attributes.SerializedNameAttribute.#ctor(System.String)">SerializedNameAttribute(String)</h4>
  125. <div class="markdown level1 summary"><p>Creates a new <a class="xref" href="IPA.Config.Stores.Attributes.SerializedNameAttribute.html">SerializedNameAttribute</a> with the given <a class="xref" href="IPA.Config.Stores.Attributes.SerializedNameAttribute.html#IPA_Config_Stores_Attributes_SerializedNameAttribute_Name">Name</a>.</p>
  126. </div>
  127. <div class="markdown level1 conceptual"></div>
  128. <h5 class="decalaration">Declaration</h5>
  129. <div class="codewrapper">
  130. <pre><code class="lang-csharp hljs">public SerializedNameAttribute(string name)</code></pre>
  131. </div>
  132. <h5 class="parameters">Parameters</h5>
  133. <table class="table table-bordered table-striped table-condensed">
  134. <thead>
  135. <tr>
  136. <th>Type</th>
  137. <th>Name</th>
  138. <th>Description</th>
  139. </tr>
  140. </thead>
  141. <tbody>
  142. <tr>
  143. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  144. <td><span class="parametername">name</span></td>
  145. <td><p>the value to assign to <a class="xref" href="IPA.Config.Stores.Attributes.SerializedNameAttribute.html#IPA_Config_Stores_Attributes_SerializedNameAttribute_Name">Name</a></p>
  146. </td>
  147. </tr>
  148. </tbody>
  149. </table>
  150. <h3 id="properties">Properties
  151. </h3>
  152. <span class="small pull-right mobile-hide">
  153. <span class="divider">|</span>
  154. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Config_Stores_Attributes_SerializedNameAttribute_Name.md&amp;value=---%0Auid%3A%20IPA.Config.Stores.Attributes.SerializedNameAttribute.Name%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  155. </span>
  156. <span class="small pull-right mobile-hide">
  157. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/c326c0dc0fbb51050db23b7b892a9528f5ef3ef0/IPA.Loader/Config/Stores/Attributes.cs/#L137">View Source</a>
  158. </span>
  159. <a id="IPA_Config_Stores_Attributes_SerializedNameAttribute_Name_" data-uid="IPA.Config.Stores.Attributes.SerializedNameAttribute.Name*"></a>
  160. <h4 id="IPA_Config_Stores_Attributes_SerializedNameAttribute_Name" data-uid="IPA.Config.Stores.Attributes.SerializedNameAttribute.Name">Name</h4>
  161. <div class="markdown level1 summary"><p>Gets the name to replace the member name with.</p>
  162. </div>
  163. <div class="markdown level1 conceptual"></div>
  164. <h5 class="decalaration">Declaration</h5>
  165. <div class="codewrapper">
  166. <pre><code class="lang-csharp hljs">public string Name { get; }</code></pre>
  167. </div>
  168. <h5 class="propertyValue">Property Value</h5>
  169. <table class="table table-bordered table-striped table-condensed">
  170. <thead>
  171. <tr>
  172. <th>Type</th>
  173. <th>Description</th>
  174. </tr>
  175. </thead>
  176. <tbody>
  177. <tr>
  178. <td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
  179. <td></td>
  180. </tr>
  181. </tbody>
  182. </table>
  183. <h3 id="extensionmethods">Extension Methods</h3>
  184. <div>
  185. <a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_SetField__2___0_System_String___1_">ReflectionUtil.SetField&lt;T, U&gt;(T, String, U)</a>
  186. </div>
  187. <div>
  188. <a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_GetField__2___1_System_String_">ReflectionUtil.GetField&lt;U, T&gt;(T, String)</a>
  189. </div>
  190. <div>
  191. <a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_SetProperty__2___0_System_String___1_">ReflectionUtil.SetProperty&lt;T, U&gt;(T, String, U)</a>
  192. </div>
  193. <div>
  194. <a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_GetProperty__2___1_System_String_">ReflectionUtil.GetProperty&lt;U, T&gt;(T, String)</a>
  195. </div>
  196. <div>
  197. <a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_InvokeMethod__2___1_System_String_System_Object___">ReflectionUtil.InvokeMethod&lt;U, T&gt;(T, String, Object[])</a>
  198. </div>
  199. </article>
  200. </div>
  201. <div class="hidden-sm col-md-2" role="complementary">
  202. <div class="sideaffix">
  203. <div class="contribution">
  204. <ul class="nav">
  205. <li>
  206. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Config_Stores_Attributes_SerializedNameAttribute.md&amp;value=---%0Auid%3A%20IPA.Config.Stores.Attributes.SerializedNameAttribute%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
  207. </li>
  208. <li>
  209. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/c326c0dc0fbb51050db23b7b892a9528f5ef3ef0/IPA.Loader/Config/Stores/Attributes.cs/#L131" class="contribution-link">View Source</a>
  210. </li>
  211. </ul>
  212. </div>
  213. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  214. <h5>In This Article</h5>
  215. <div></div>
  216. </nav>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. <footer>
  222. <div class="grad-bottom"></div>
  223. <div class="footer">
  224. <div class="container">
  225. <span class="pull-right">
  226. <a href="#top">Back to top</a>
  227. </span>
  228. <span>Generated by <strong>DocFX</strong></span>
  229. </div>
  230. </div>
  231. </footer>
  232. </div>
  233. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  234. <script type="text/javascript" src="../styles/docfx.js"></script>
  235. <script type="text/javascript" src="../styles/main.js"></script>
  236. </body>
  237. </html>