title: If I inline a HashSet collection initialization, does the compiler know to do it only once?
body: <p>I often do this...</p>
  
  <pre><code>private void Check()
   {
   string s = "blah";
  
   if ( new HashSet&lt;string&gt;{"Joe","Eddie","Buckethead"}.Contains(s) )
     Debug.Log("Guitarist.");
   }
  </code></pre>
  
  <p>In the pipeline, is the HashSet in fact created only the once (at startup time? compile time?) and then used every time?</p>
  
  <p>By the way, I assume that if you do this:</p>
  
  <pre><code>private HashSet&lt;string&gt; g = new HashSet&lt;string&gt;()
                           {"Joe","Eddie","Buckethead"};
  private void Check()
   {
   string s = "blah";
  
   if ( g.Contains(s) )
    Debug.Log("Guitarist.");
   }
  </code></pre>
  
  <p>then indeed, of course it is only done once when the Class is instantiated. (Or, perhaps at compile time / launch time? But in any event, only the once.)</p>