title: Passing List<Class> as argument, C#, using "ref" keyword
body: <p>friends!</p>
  
  <p>So I have been writing a simple program. Basically, I have a class (3 strings, 1 int, some methods). I am initializing the values of objects of this class from a text file. I am using List for this.
  The problem is that initialization is a separate function. I had List BOTH declared AND initialized in this function. However, I might need it in other functions, including "Program.Main".</p>
  
  <p>Should I make a "Global" class and put make a <b>public List&lt; Class ></b> ? I decided to just declare it in my Program.Main function as of now. However, I am not sure, if a List is passed by value or by reference.  I found a page on the Web, which suggests using <b>ref</b> keyword. Now I have:</p>
  
  <pre><code>public Class FooClass
  {...}
  
  class Program
  {
      static void Main(string[] args)
      {
        List&lt;FooClass&gt; fooDB = new List&lt;FooClass&gt;;
        initFromFile(ref fooDB);
      }
  
      private static initFromFile(ref List&lt;FooClass&gt; fooDB)
      {
         using (StreamReader ... )
         {
            while( ... )
            {
               ...
               fooDB.Add(new FooClass(args))
            }
         }
       }//initFromFile
  
  }//Program
  </code></pre>
  
  <p>Should I keep on working like this? Or are there any crucial suggestions? Maybe "ref" isn't a good practice at all? </p>
  
  <p><b>TLDR: Should i make a global <i>List</i> or pass it as a reference or another way(suggest). If passing by reference, then should I use a <i>ref</i> keyword or is there another way? </b></p>
  
  <p>Thanks in advance,</p>
  
  <p>~~~hlfrmn</p>