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.

843 lines
37 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  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 ReflectionUtil
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class ReflectionUtil
  11. ">
  12. <meta name="generator" content="docfx 2.59.4.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.Utilities.ReflectionUtil">
  75. <h1 id="IPA_Utilities_ReflectionUtil" data-uid="IPA.Utilities.ReflectionUtil" class="text-break">Class ReflectionUtil
  76. </h1>
  77. <div class="markdown level0 summary"><p>A utility class providing reflection helper methods.</p>
  78. </div>
  79. <div class="markdown level0 conceptual"></div>
  80. <div class="inheritance">
  81. <h5>Inheritance</h5>
  82. <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">Object</a></div>
  83. <div class="level1"><span class="xref">ReflectionUtil</span></div>
  84. </div>
  85. <div class="inheritedMembers">
  86. <h5>Inherited Members</h5>
  87. <div>
  88. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring#system-object-tostring">Object.ToString()</a>
  89. </div>
  90. <div>
  91. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">Object.Equals(Object)</a>
  92. </div>
  93. <div>
  94. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">Object.Equals(Object, Object)</a>
  95. </div>
  96. <div>
  97. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals#system-object-referenceequals(system-object-system-object)">Object.ReferenceEquals(Object, Object)</a>
  98. </div>
  99. <div>
  100. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode#system-object-gethashcode">Object.GetHashCode()</a>
  101. </div>
  102. <div>
  103. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype#system-object-gettype">Object.GetType()</a>
  104. </div>
  105. <div>
  106. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone#system-object-memberwiseclone">Object.MemberwiseClone()</a>
  107. </div>
  108. </div>
  109. <h6><strong>Namespace</strong>: <a class="xref" href="IPA.Utilities.html">IPA.Utilities</a></h6>
  110. <h6><strong>Assembly</strong>: IPA.Loader.dll</h6>
  111. <h5 id="IPA_Utilities_ReflectionUtil_syntax">Syntax</h5>
  112. <div class="codewrapper">
  113. <pre><code class="lang-csharp hljs">public static class ReflectionUtil</code></pre>
  114. </div>
  115. <h3 id="methods">Methods
  116. </h3>
  117. <span class="small pull-right mobile-hide">
  118. <span class="divider">|</span>
  119. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.CopyComponent(UnityEngine.Component%2CSystem.Type%2CUnityEngine.GameObject%2CSystem.Type)%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>
  120. </span>
  121. <span class="small pull-right mobile-hide">
  122. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L93">View Source</a>
  123. </span>
  124. <a id="IPA_Utilities_ReflectionUtil_CopyComponent_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent*"></a>
  125. <h4 id="IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent(UnityEngine.Component,System.Type,UnityEngine.GameObject,System.Type)">CopyComponent(Component, Type, GameObject, Type)</h4>
  126. <div class="markdown level1 summary"><p>Copies a component <code data-dev-comment-type="paramref" class="paramref">original</code> to a component of <code data-dev-comment-type="paramref" class="paramref">overridingType</code> on the destination <span class="xref">UnityEngine.GameObject</span>.</p>
  127. </div>
  128. <div class="markdown level1 conceptual"></div>
  129. <h5 class="decalaration">Declaration</h5>
  130. <div class="codewrapper">
  131. <pre><code class="lang-csharp hljs">public static Component CopyComponent(this Component original, Type overridingType, GameObject destination, Type originalTypeOverride = null)</code></pre>
  132. </div>
  133. <h5 class="parameters">Parameters</h5>
  134. <table class="table table-bordered table-striped table-condensed">
  135. <thead>
  136. <tr>
  137. <th>Type</th>
  138. <th>Name</th>
  139. <th>Description</th>
  140. </tr>
  141. </thead>
  142. <tbody>
  143. <tr>
  144. <td><span class="xref">UnityEngine.Component</span></td>
  145. <td><span class="parametername">original</span></td>
  146. <td><p>the original component</p>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a></td>
  151. <td><span class="parametername">overridingType</span></td>
  152. <td><p>the new component&apos;s type</p>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td><span class="xref">UnityEngine.GameObject</span></td>
  157. <td><span class="parametername">destination</span></td>
  158. <td><p>the destination GameObject</p>
  159. </td>
  160. </tr>
  161. <tr>
  162. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a></td>
  163. <td><span class="parametername">originalTypeOverride</span></td>
  164. <td><p>overrides the source component type (for example, to a superclass)</p>
  165. </td>
  166. </tr>
  167. </tbody>
  168. </table>
  169. <h5 class="returns">Returns</h5>
  170. <table class="table table-bordered table-striped table-condensed">
  171. <thead>
  172. <tr>
  173. <th>Type</th>
  174. <th>Description</th>
  175. </tr>
  176. </thead>
  177. <tbody>
  178. <tr>
  179. <td><span class="xref">UnityEngine.Component</span></td>
  180. <td><p>the copied component</p>
  181. </td>
  182. </tr>
  183. </tbody>
  184. </table>
  185. <span class="small pull-right mobile-hide">
  186. <span class="divider">|</span>
  187. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_CopyComponent__1_UnityEngine_Component_UnityEngine_GameObject_System_Type_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.CopyComponent%60%601(UnityEngine.Component%2CUnityEngine.GameObject%2CSystem.Type)%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>
  188. </span>
  189. <span class="small pull-right mobile-hide">
  190. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L117">View Source</a>
  191. </span>
  192. <a id="IPA_Utilities_ReflectionUtil_CopyComponent_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent*"></a>
  193. <h4 id="IPA_Utilities_ReflectionUtil_CopyComponent__1_UnityEngine_Component_UnityEngine_GameObject_System_Type_" data-uid="IPA.Utilities.ReflectionUtil.CopyComponent``1(UnityEngine.Component,UnityEngine.GameObject,System.Type)">CopyComponent&lt;T&gt;(Component, GameObject, Type)</h4>
  194. <div class="markdown level1 summary"><p>A generic version of <a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_">CopyComponent(Component, Type, GameObject, Type)</a>. </p>
  195. </div>
  196. <div class="markdown level1 conceptual"></div>
  197. <h5 class="decalaration">Declaration</h5>
  198. <div class="codewrapper">
  199. <pre><code class="lang-csharp hljs">public static T CopyComponent&lt;T&gt;(this Component original, GameObject destination, Type originalTypeOverride = null)
  200. where T : Component</code></pre>
  201. </div>
  202. <h5 class="parameters">Parameters</h5>
  203. <table class="table table-bordered table-striped table-condensed">
  204. <thead>
  205. <tr>
  206. <th>Type</th>
  207. <th>Name</th>
  208. <th>Description</th>
  209. </tr>
  210. </thead>
  211. <tbody>
  212. <tr>
  213. <td><span class="xref">UnityEngine.Component</span></td>
  214. <td><span class="parametername">original</span></td>
  215. <td><p>the original component</p>
  216. </td>
  217. </tr>
  218. <tr>
  219. <td><span class="xref">UnityEngine.GameObject</span></td>
  220. <td><span class="parametername">destination</span></td>
  221. <td><p>the destination game object</p>
  222. </td>
  223. </tr>
  224. <tr>
  225. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a></td>
  226. <td><span class="parametername">originalTypeOverride</span></td>
  227. <td><p>overrides the source component type (for example, to a superclass)</p>
  228. </td>
  229. </tr>
  230. </tbody>
  231. </table>
  232. <h5 class="returns">Returns</h5>
  233. <table class="table table-bordered table-striped table-condensed">
  234. <thead>
  235. <tr>
  236. <th>Type</th>
  237. <th>Description</th>
  238. </tr>
  239. </thead>
  240. <tbody>
  241. <tr>
  242. <td><span class="xref">T</span></td>
  243. <td><p>the copied component</p>
  244. </td>
  245. </tr>
  246. </tbody>
  247. </table>
  248. <h5 class="typeParameters">Type Parameters</h5>
  249. <table class="table table-bordered table-striped table-condensed">
  250. <thead>
  251. <tr>
  252. <th>Name</th>
  253. <th>Description</th>
  254. </tr>
  255. </thead>
  256. <tbody>
  257. <tr>
  258. <td><span class="parametername">T</span></td>
  259. <td><p>the overriding type</p>
  260. </td>
  261. </tr>
  262. </tbody>
  263. </table>
  264. <h5 id="IPA_Utilities_ReflectionUtil_CopyComponent__1_UnityEngine_Component_UnityEngine_GameObject_System_Type__seealso">See Also</h5>
  265. <div class="seealso">
  266. <div><a class="xref" href="IPA.Utilities.ReflectionUtil.html#IPA_Utilities_ReflectionUtil_CopyComponent_UnityEngine_Component_System_Type_UnityEngine_GameObject_System_Type_">CopyComponent(Component, Type, GameObject, Type)</a></div>
  267. </div>
  268. <span class="small pull-right mobile-hide">
  269. <span class="divider">|</span>
  270. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_GetField__2___1_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.GetField%60%602(%60%601%2CSystem.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>
  271. </span>
  272. <span class="small pull-right mobile-hide">
  273. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L39">View Source</a>
  274. </span>
  275. <a id="IPA_Utilities_ReflectionUtil_GetField_" data-uid="IPA.Utilities.ReflectionUtil.GetField*"></a>
  276. <h4 id="IPA_Utilities_ReflectionUtil_GetField__2___1_System_String_" data-uid="IPA.Utilities.ReflectionUtil.GetField``2(``1,System.String)">GetField&lt;U, T&gt;(T, String)</h4>
  277. <div class="markdown level1 summary"><p>Gets the value of a field.</p>
  278. </div>
  279. <div class="markdown level1 conceptual"></div>
  280. <h5 class="decalaration">Declaration</h5>
  281. <div class="codewrapper">
  282. <pre><code class="lang-csharp hljs">public static U GetField&lt;U, T&gt;(this T obj, string fieldName)</code></pre>
  283. </div>
  284. <h5 class="parameters">Parameters</h5>
  285. <table class="table table-bordered table-striped table-condensed">
  286. <thead>
  287. <tr>
  288. <th>Type</th>
  289. <th>Name</th>
  290. <th>Description</th>
  291. </tr>
  292. </thead>
  293. <tbody>
  294. <tr>
  295. <td><span class="xref">T</span></td>
  296. <td><span class="parametername">obj</span></td>
  297. <td><p>the object instance to pull from</p>
  298. </td>
  299. </tr>
  300. <tr>
  301. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">String</a></td>
  302. <td><span class="parametername">fieldName</span></td>
  303. <td><p>the name of the field to read</p>
  304. </td>
  305. </tr>
  306. </tbody>
  307. </table>
  308. <h5 class="returns">Returns</h5>
  309. <table class="table table-bordered table-striped table-condensed">
  310. <thead>
  311. <tr>
  312. <th>Type</th>
  313. <th>Description</th>
  314. </tr>
  315. </thead>
  316. <tbody>
  317. <tr>
  318. <td><span class="xref">U</span></td>
  319. <td><p>the value of the field</p>
  320. </td>
  321. </tr>
  322. </tbody>
  323. </table>
  324. <h5 class="typeParameters">Type Parameters</h5>
  325. <table class="table table-bordered table-striped table-condensed">
  326. <thead>
  327. <tr>
  328. <th>Name</th>
  329. <th>Description</th>
  330. </tr>
  331. </thead>
  332. <tbody>
  333. <tr>
  334. <td><span class="parametername">U</span></td>
  335. <td><p>the type of the field (result casted)</p>
  336. </td>
  337. </tr>
  338. <tr>
  339. <td><span class="parametername">T</span></td>
  340. <td><p>the type to get the field from</p>
  341. </td>
  342. </tr>
  343. </tbody>
  344. </table>
  345. <h5 class="exceptions">Exceptions</h5>
  346. <table class="table table-bordered table-striped table-condensed">
  347. <thead>
  348. <tr>
  349. <th>Type</th>
  350. <th>Condition</th>
  351. </tr>
  352. </thead>
  353. <tbody>
  354. <tr>
  355. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.missingfieldexception">MissingFieldException</a></td>
  356. <td><p>if <code data-dev-comment-type="paramref" class="paramref">fieldName</code> does not exist on <code data-dev-comment-type="typeparamref" class="typeparamref">T</code></p>
  357. </td>
  358. </tr>
  359. </tbody>
  360. </table>
  361. <h5 id="IPA_Utilities_ReflectionUtil_GetField__2___1_System_String__seealso">See Also</h5>
  362. <div class="seealso">
  363. <div><a class="xref" href="IPA.Utilities.FieldAccessor-2.html#IPA_Utilities_FieldAccessor_2_Get__0__System_String_">Get(ref T, String)</a></div>
  364. </div>
  365. <span class="small pull-right mobile-hide">
  366. <span class="divider">|</span>
  367. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_GetProperty__2___1_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.GetProperty%60%602(%60%601%2CSystem.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>
  368. </span>
  369. <span class="small pull-right mobile-hide">
  370. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L65">View Source</a>
  371. </span>
  372. <a id="IPA_Utilities_ReflectionUtil_GetProperty_" data-uid="IPA.Utilities.ReflectionUtil.GetProperty*"></a>
  373. <h4 id="IPA_Utilities_ReflectionUtil_GetProperty__2___1_System_String_" data-uid="IPA.Utilities.ReflectionUtil.GetProperty``2(``1,System.String)">GetProperty&lt;U, T&gt;(T, String)</h4>
  374. <div class="markdown level1 summary"><p>Gets a property on the target object, as gotten from <code data-dev-comment-type="typeparamref" class="typeparamref">T</code>.</p>
  375. </div>
  376. <div class="markdown level1 conceptual"></div>
  377. <h5 class="decalaration">Declaration</h5>
  378. <div class="codewrapper">
  379. <pre><code class="lang-csharp hljs">public static U GetProperty&lt;U, T&gt;(this T obj, string propertyName)</code></pre>
  380. </div>
  381. <h5 class="parameters">Parameters</h5>
  382. <table class="table table-bordered table-striped table-condensed">
  383. <thead>
  384. <tr>
  385. <th>Type</th>
  386. <th>Name</th>
  387. <th>Description</th>
  388. </tr>
  389. </thead>
  390. <tbody>
  391. <tr>
  392. <td><span class="xref">T</span></td>
  393. <td><span class="parametername">obj</span></td>
  394. <td><p>the object instance</p>
  395. </td>
  396. </tr>
  397. <tr>
  398. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">String</a></td>
  399. <td><span class="parametername">propertyName</span></td>
  400. <td><p>the property to get</p>
  401. </td>
  402. </tr>
  403. </tbody>
  404. </table>
  405. <h5 class="returns">Returns</h5>
  406. <table class="table table-bordered table-striped table-condensed">
  407. <thead>
  408. <tr>
  409. <th>Type</th>
  410. <th>Description</th>
  411. </tr>
  412. </thead>
  413. <tbody>
  414. <tr>
  415. <td><span class="xref">U</span></td>
  416. <td><p>the value of the property</p>
  417. </td>
  418. </tr>
  419. </tbody>
  420. </table>
  421. <h5 class="typeParameters">Type Parameters</h5>
  422. <table class="table table-bordered table-striped table-condensed">
  423. <thead>
  424. <tr>
  425. <th>Name</th>
  426. <th>Description</th>
  427. </tr>
  428. </thead>
  429. <tbody>
  430. <tr>
  431. <td><span class="parametername">U</span></td>
  432. <td><p>the type of the property to get</p>
  433. </td>
  434. </tr>
  435. <tr>
  436. <td><span class="parametername">T</span></td>
  437. <td><p>the type to get the property from</p>
  438. </td>
  439. </tr>
  440. </tbody>
  441. </table>
  442. <h5 class="exceptions">Exceptions</h5>
  443. <table class="table table-bordered table-striped table-condensed">
  444. <thead>
  445. <tr>
  446. <th>Type</th>
  447. <th>Condition</th>
  448. </tr>
  449. </thead>
  450. <tbody>
  451. <tr>
  452. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.missingmemberexception">MissingMemberException</a></td>
  453. <td><p>if <code data-dev-comment-type="paramref" class="paramref">propertyName</code> does not exist on <code data-dev-comment-type="typeparamref" class="typeparamref">T</code></p>
  454. </td>
  455. </tr>
  456. </tbody>
  457. </table>
  458. <h5 id="IPA_Utilities_ReflectionUtil_GetProperty__2___1_System_String__seealso">See Also</h5>
  459. <div class="seealso">
  460. <div><a class="xref" href="IPA.Utilities.PropertyAccessor-2.html#IPA_Utilities_PropertyAccessor_2_Get__0__System_String_">Get(ref T, String)</a></div>
  461. </div>
  462. <span class="small pull-right mobile-hide">
  463. <span class="divider">|</span>
  464. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_InvokeMethod__2___1_System_String_System_Object___.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.InvokeMethod%60%602(%60%601%2CSystem.String%2CSystem.Object%5B%5D)%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>
  465. </span>
  466. <span class="small pull-right mobile-hide">
  467. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L78">View Source</a>
  468. </span>
  469. <a id="IPA_Utilities_ReflectionUtil_InvokeMethod_" data-uid="IPA.Utilities.ReflectionUtil.InvokeMethod*"></a>
  470. <h4 id="IPA_Utilities_ReflectionUtil_InvokeMethod__2___1_System_String_System_Object___" data-uid="IPA.Utilities.ReflectionUtil.InvokeMethod``2(``1,System.String,System.Object[])">InvokeMethod&lt;U, T&gt;(T, String, Object[])</h4>
  471. <div class="markdown level1 summary"><p>Invokes a method from <code data-dev-comment-type="typeparamref" class="typeparamref">T</code> on an object.</p>
  472. </div>
  473. <div class="markdown level1 conceptual"></div>
  474. <h5 class="decalaration">Declaration</h5>
  475. <div class="codewrapper">
  476. <pre><code class="lang-csharp hljs">public static U InvokeMethod&lt;U, T&gt;(this T obj, string methodName, params object[] args)</code></pre>
  477. </div>
  478. <h5 class="parameters">Parameters</h5>
  479. <table class="table table-bordered table-striped table-condensed">
  480. <thead>
  481. <tr>
  482. <th>Type</th>
  483. <th>Name</th>
  484. <th>Description</th>
  485. </tr>
  486. </thead>
  487. <tbody>
  488. <tr>
  489. <td><span class="xref">T</span></td>
  490. <td><span class="parametername">obj</span></td>
  491. <td><p>the object instance</p>
  492. </td>
  493. </tr>
  494. <tr>
  495. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">String</a></td>
  496. <td><span class="parametername">methodName</span></td>
  497. <td><p>the method&apos;s name</p>
  498. </td>
  499. </tr>
  500. <tr>
  501. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">Object</a>[]</td>
  502. <td><span class="parametername">args</span></td>
  503. <td><p>the method arguments</p>
  504. </td>
  505. </tr>
  506. </tbody>
  507. </table>
  508. <h5 class="returns">Returns</h5>
  509. <table class="table table-bordered table-striped table-condensed">
  510. <thead>
  511. <tr>
  512. <th>Type</th>
  513. <th>Description</th>
  514. </tr>
  515. </thead>
  516. <tbody>
  517. <tr>
  518. <td><span class="xref">U</span></td>
  519. <td><p>the return value</p>
  520. </td>
  521. </tr>
  522. </tbody>
  523. </table>
  524. <h5 class="typeParameters">Type Parameters</h5>
  525. <table class="table table-bordered table-striped table-condensed">
  526. <thead>
  527. <tr>
  528. <th>Name</th>
  529. <th>Description</th>
  530. </tr>
  531. </thead>
  532. <tbody>
  533. <tr>
  534. <td><span class="parametername">U</span></td>
  535. <td><p>the type that the method returns</p>
  536. </td>
  537. </tr>
  538. <tr>
  539. <td><span class="parametername">T</span></td>
  540. <td><p>the type to search for the method on</p>
  541. </td>
  542. </tr>
  543. </tbody>
  544. </table>
  545. <h5 class="exceptions">Exceptions</h5>
  546. <table class="table table-bordered table-striped table-condensed">
  547. <thead>
  548. <tr>
  549. <th>Type</th>
  550. <th>Condition</th>
  551. </tr>
  552. </thead>
  553. <tbody>
  554. <tr>
  555. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.missingmethodexception">MissingMethodException</a></td>
  556. <td><p>if <code data-dev-comment-type="paramref" class="paramref">methodName</code> does not exist on <code data-dev-comment-type="typeparamref" class="typeparamref">T</code></p>
  557. </td>
  558. </tr>
  559. </tbody>
  560. </table>
  561. <span class="small pull-right mobile-hide">
  562. <span class="divider">|</span>
  563. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_SetField__2___0_System_String___1_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.SetField%60%602(%60%600%2CSystem.String%2C%60%601)%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>
  564. </span>
  565. <span class="small pull-right mobile-hide">
  566. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L26">View Source</a>
  567. </span>
  568. <a id="IPA_Utilities_ReflectionUtil_SetField_" data-uid="IPA.Utilities.ReflectionUtil.SetField*"></a>
  569. <h4 id="IPA_Utilities_ReflectionUtil_SetField__2___0_System_String___1_" data-uid="IPA.Utilities.ReflectionUtil.SetField``2(``0,System.String,``1)">SetField&lt;T, U&gt;(T, String, U)</h4>
  570. <div class="markdown level1 summary"><p>Sets a field on the target object, as gotten from <code data-dev-comment-type="typeparamref" class="typeparamref">T</code>.</p>
  571. </div>
  572. <div class="markdown level1 conceptual"></div>
  573. <h5 class="decalaration">Declaration</h5>
  574. <div class="codewrapper">
  575. <pre><code class="lang-csharp hljs">public static void SetField&lt;T, U&gt;(this T obj, string fieldName, U value)</code></pre>
  576. </div>
  577. <h5 class="parameters">Parameters</h5>
  578. <table class="table table-bordered table-striped table-condensed">
  579. <thead>
  580. <tr>
  581. <th>Type</th>
  582. <th>Name</th>
  583. <th>Description</th>
  584. </tr>
  585. </thead>
  586. <tbody>
  587. <tr>
  588. <td><span class="xref">T</span></td>
  589. <td><span class="parametername">obj</span></td>
  590. <td><p>the object instance</p>
  591. </td>
  592. </tr>
  593. <tr>
  594. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">String</a></td>
  595. <td><span class="parametername">fieldName</span></td>
  596. <td><p>the field to set</p>
  597. </td>
  598. </tr>
  599. <tr>
  600. <td><span class="xref">U</span></td>
  601. <td><span class="parametername">value</span></td>
  602. <td><p>the value to set it to</p>
  603. </td>
  604. </tr>
  605. </tbody>
  606. </table>
  607. <h5 class="typeParameters">Type Parameters</h5>
  608. <table class="table table-bordered table-striped table-condensed">
  609. <thead>
  610. <tr>
  611. <th>Name</th>
  612. <th>Description</th>
  613. </tr>
  614. </thead>
  615. <tbody>
  616. <tr>
  617. <td><span class="parametername">T</span></td>
  618. <td><p>the type to get the field from</p>
  619. </td>
  620. </tr>
  621. <tr>
  622. <td><span class="parametername">U</span></td>
  623. <td><p>the type of the field to set</p>
  624. </td>
  625. </tr>
  626. </tbody>
  627. </table>
  628. <h5 class="exceptions">Exceptions</h5>
  629. <table class="table table-bordered table-striped table-condensed">
  630. <thead>
  631. <tr>
  632. <th>Type</th>
  633. <th>Condition</th>
  634. </tr>
  635. </thead>
  636. <tbody>
  637. <tr>
  638. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.missingfieldexception">MissingFieldException</a></td>
  639. <td><p>if <code data-dev-comment-type="paramref" class="paramref">fieldName</code> does not exist on <code data-dev-comment-type="typeparamref" class="typeparamref">T</code></p>
  640. </td>
  641. </tr>
  642. </tbody>
  643. </table>
  644. <h5 id="IPA_Utilities_ReflectionUtil_SetField__2___0_System_String___1__seealso">See Also</h5>
  645. <div class="seealso">
  646. <div><a class="xref" href="IPA.Utilities.FieldAccessor-2.html#IPA_Utilities_FieldAccessor_2_Set__0__System_String__1_">Set(ref T, String, U)</a></div>
  647. </div>
  648. <span class="small pull-right mobile-hide">
  649. <span class="divider">|</span>
  650. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_SetProperty__2___0_System_String___1_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.SetProperty%60%602(%60%600%2CSystem.String%2C%60%601)%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>
  651. </span>
  652. <span class="small pull-right mobile-hide">
  653. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L52">View Source</a>
  654. </span>
  655. <a id="IPA_Utilities_ReflectionUtil_SetProperty_" data-uid="IPA.Utilities.ReflectionUtil.SetProperty*"></a>
  656. <h4 id="IPA_Utilities_ReflectionUtil_SetProperty__2___0_System_String___1_" data-uid="IPA.Utilities.ReflectionUtil.SetProperty``2(``0,System.String,``1)">SetProperty&lt;T, U&gt;(T, String, U)</h4>
  657. <div class="markdown level1 summary"><p>Sets a property on the target object, as gotten from <code data-dev-comment-type="typeparamref" class="typeparamref">T</code>.</p>
  658. </div>
  659. <div class="markdown level1 conceptual"></div>
  660. <h5 class="decalaration">Declaration</h5>
  661. <div class="codewrapper">
  662. <pre><code class="lang-csharp hljs">public static void SetProperty&lt;T, U&gt;(this T obj, string propertyName, U value)</code></pre>
  663. </div>
  664. <h5 class="parameters">Parameters</h5>
  665. <table class="table table-bordered table-striped table-condensed">
  666. <thead>
  667. <tr>
  668. <th>Type</th>
  669. <th>Name</th>
  670. <th>Description</th>
  671. </tr>
  672. </thead>
  673. <tbody>
  674. <tr>
  675. <td><span class="xref">T</span></td>
  676. <td><span class="parametername">obj</span></td>
  677. <td><p>the object instance</p>
  678. </td>
  679. </tr>
  680. <tr>
  681. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">String</a></td>
  682. <td><span class="parametername">propertyName</span></td>
  683. <td><p>the property to set</p>
  684. </td>
  685. </tr>
  686. <tr>
  687. <td><span class="xref">U</span></td>
  688. <td><span class="parametername">value</span></td>
  689. <td><p>the value to set it to</p>
  690. </td>
  691. </tr>
  692. </tbody>
  693. </table>
  694. <h5 class="typeParameters">Type Parameters</h5>
  695. <table class="table table-bordered table-striped table-condensed">
  696. <thead>
  697. <tr>
  698. <th>Name</th>
  699. <th>Description</th>
  700. </tr>
  701. </thead>
  702. <tbody>
  703. <tr>
  704. <td><span class="parametername">T</span></td>
  705. <td><p>the type to get the property from</p>
  706. </td>
  707. </tr>
  708. <tr>
  709. <td><span class="parametername">U</span></td>
  710. <td><p>the type of the property to set</p>
  711. </td>
  712. </tr>
  713. </tbody>
  714. </table>
  715. <h5 class="exceptions">Exceptions</h5>
  716. <table class="table table-bordered table-striped table-condensed">
  717. <thead>
  718. <tr>
  719. <th>Type</th>
  720. <th>Condition</th>
  721. </tr>
  722. </thead>
  723. <tbody>
  724. <tr>
  725. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.missingmemberexception">MissingMemberException</a></td>
  726. <td><p>if <code data-dev-comment-type="paramref" class="paramref">propertyName</code> does not exist on <code data-dev-comment-type="typeparamref" class="typeparamref">T</code></p>
  727. </td>
  728. </tr>
  729. </tbody>
  730. </table>
  731. <h5 id="IPA_Utilities_ReflectionUtil_SetProperty__2___0_System_String___1__seealso">See Also</h5>
  732. <div class="seealso">
  733. <div><a class="xref" href="IPA.Utilities.PropertyAccessor-2.html#IPA_Utilities_PropertyAccessor_2_Set__0__System_String__1_">Set(ref T, String, U)</a></div>
  734. </div>
  735. <span class="small pull-right mobile-hide">
  736. <span class="divider">|</span>
  737. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil_ToCompilerGeneratedBackingField_System_String_.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil.ToCompilerGeneratedBackingField(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>
  738. </span>
  739. <span class="small pull-right mobile-hide">
  740. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L144">View Source</a>
  741. </span>
  742. <a id="IPA_Utilities_ReflectionUtil_ToCompilerGeneratedBackingField_" data-uid="IPA.Utilities.ReflectionUtil.ToCompilerGeneratedBackingField*"></a>
  743. <h4 id="IPA_Utilities_ReflectionUtil_ToCompilerGeneratedBackingField_System_String_" data-uid="IPA.Utilities.ReflectionUtil.ToCompilerGeneratedBackingField(System.String)">ToCompilerGeneratedBackingField(String)</h4>
  744. <div class="markdown level1 summary"><p>Converts the property name to the one of the compiler-generated backing field.
  745. This can be used for the field-based reflection when you want to set the value of a get-only property</p>
  746. </div>
  747. <div class="markdown level1 conceptual"></div>
  748. <h5 class="decalaration">Declaration</h5>
  749. <div class="codewrapper">
  750. <pre><code class="lang-csharp hljs">public static string ToCompilerGeneratedBackingField(string propertyName)</code></pre>
  751. </div>
  752. <h5 class="parameters">Parameters</h5>
  753. <table class="table table-bordered table-striped table-condensed">
  754. <thead>
  755. <tr>
  756. <th>Type</th>
  757. <th>Name</th>
  758. <th>Description</th>
  759. </tr>
  760. </thead>
  761. <tbody>
  762. <tr>
  763. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">String</a></td>
  764. <td><span class="parametername">propertyName</span></td>
  765. <td><p>Name of the property</p>
  766. </td>
  767. </tr>
  768. </tbody>
  769. </table>
  770. <h5 class="returns">Returns</h5>
  771. <table class="table table-bordered table-striped table-condensed">
  772. <thead>
  773. <tr>
  774. <th>Type</th>
  775. <th>Description</th>
  776. </tr>
  777. </thead>
  778. <tbody>
  779. <tr>
  780. <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">String</a></td>
  781. <td><p>Name of the backing field</p>
  782. </td>
  783. </tr>
  784. </tbody>
  785. </table>
  786. <h5 id="IPA_Utilities_ReflectionUtil_ToCompilerGeneratedBackingField_System_String__remarks">Remarks</h5>
  787. <div class="markdown level1 remarks"><p>Only works for properties with compiler-generated backing fields.
  788. This is only a simple method and doesn&apos;t have any guarantees to work 100% of the time across different compilers/runtimes.
  789. See <a href="https://github.com/dotnet/roslyn/blob/1497e87d967c5b7797edb5f782131508607139e5/src/Compilers/CSharp/Portable/Symbols/Synthesized/GeneratedNames.cs#L24-L28">this link</a> for more info.</p>
  790. </div>
  791. </article>
  792. </div>
  793. <div class="hidden-sm col-md-2" role="complementary">
  794. <div class="sideaffix">
  795. <div class="contribution">
  796. <ul class="nav">
  797. <li>
  798. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/new/master/docs/override/new?filename=IPA_Utilities_ReflectionUtil.md&amp;value=---%0Auid%3A%20IPA.Utilities.ReflectionUtil%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>
  799. </li>
  800. <li>
  801. <a href="https://github.com/nike4613/BeatSaber-IPA-Reloaded/blob/80222a6da147bae9b95433ef78d03c5dd581e465/IPA.Loader/Utilities/ReflectionUtil.cs/#L11" class="contribution-link">View Source</a>
  802. </li>
  803. </ul>
  804. </div>
  805. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  806. <h5>In This Article</h5>
  807. <div></div>
  808. </nav>
  809. </div>
  810. </div>
  811. </div>
  812. </div>
  813. <footer>
  814. <div class="grad-bottom"></div>
  815. <div class="footer">
  816. <div class="container">
  817. <span class="pull-right">
  818. <a href="#top">Back to top</a>
  819. </span>
  820. <span>Generated by <strong>DocFX</strong></span>
  821. </div>
  822. </div>
  823. </footer>
  824. </div>
  825. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  826. <script type="text/javascript" src="../styles/docfx.js"></script>
  827. <script type="text/javascript" src="../styles/main.js"></script>
  828. </body>
  829. </html>