title: C# How light is Assembly.ReflectionOnlyLoad
body: <p>I have a number of assemblies which I treat as libraries in my Unity game. When the game starts, I want to quickly read just the manifest of all files - there may be some 50+ at some point in the future - and make a list in memory.</p>
  
  <p>I have packed some useful info in the copyright and product information fields which are sufficient to read, but I certainly do not want to load the whole assembly into my app domain or any other app domain.</p>
  
  <p>AssemblyName.GetAssemblyName seems to be the most light weight </p>
  
  <pre><code>AssemblyName myAssemblyName = AssemblyName.GetAssemblyName("E:/Code/Projects/MyUtilities/bin/Debug/MyUtilities.dll");
  </code></pre>
  
  <p>But does not help as it only gives the assembly name, version and culture info. These cannot have custom strings anyway(the assembly fails to compile if I force some custom strings in there using the code in AssemblyInfo.cs)</p>
  
  <p>So that brings me to the last option which is Assembly.ReflectionOnlyLoadFrom</p>
  
  <pre><code>Assembly myAssembly = Assembly.ReflectionOnlyLoadFrom("E:/Code/Projects/MyUtilities/bin/Debug/MyUtilities.dll");
  
  object[] map = myAssembly.GetCustomAttributes(false);
  </code></pre>
  
  <p>Does this actually load the whole file? That would be too much for me as I only want the attributes. </p>
  
  <p>If it does then I am left with no options but to prepend some extra bytes to the assembly file myself and remove the bytes before I hand the byte array to       </p>
  
  <pre><code>Assembly.Load(bytes);
  </code></pre>