title: Accessing instance variables across multiple c# files
body: <p>What is the preferred method for accessing variables that need to be instantiated across multiple C# files?</p>
  
  <p>For example a dictionary cannot be declared in one file and used in another unless it is passed from method to method.</p>
  
  <p>I have the same problem with an array of bytes.</p>
  
  <p>I am primarily a C++ coder and these problems are handled by include files or extern declarations.</p>
  
  <p>'Small' variables in C# can be global. But this option - to the best of my knowledge - is not possible with variables that need to be instantiated like dictionaries or byte arrays.</p>
  
  <p>Sorry for the newbie question but I can't find any solutions in my books or on the Internet. I've already wasted a good part of today trying to figure out how to use a dictionary in two C# files in the same project without any answers.</p>
  
  <p>To try and be more detailed about the problem:</p>
  
  <p>This is the declaration in MainWindow.xaml.cs:</p>
  
  <pre><code> public partial class MainWindow : Window
  {
      public static byte[,] TerrainMap;
  </code></pre>
  
  <p>But when I try to access it in another file PlantDisplay.xaml.cs (which shares the same namespace) it throws the error:  error CS0103: The name 'TerrainMap' does not exist in the current context</p>