title: Is it possible to create static field on base class but affect like creating on child class?
body: <p>I need to create base class like the following code.</p>
  
  <pre><code>public class ResourceBase
  {
      protected static IDictionary&lt;string, XDocument&gt; resources;
  
      protected static IDictionary&lt;string, XDocument&gt; Resources
      {
          get
          {
              if (resources == null)
              {
                  // cache XDocument instance in resources variable seperate by culture name.
                  // load resx file to XDocument
              }
  
              return resources;                
          }
      }
  
      protected static string GetString(string resourceKey)
      {
          return GetString(resourceKey, System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
      }
  
      protected static string GetString(string resourceKey, string cultureName)
      {
          // get data from XDocument instance
          var result = (
                          from rs in Resources
                          let node = rs.Value.Root.Elements(XName.Get("data")).SingleOrDefault&lt;XElement&gt;(x =&gt; x.Attribute(XName.Get("name")).Value == resourceKey)
                          where
                                  (rs.Key == DEFAULT_CULTUREKEY || cultureName == rs.Key) &amp;&amp;
                                  node != null
                          orderby cultureName == rs.Key descending
                          select node.Element(XName.Get("value"))
                       ).FirstOrDefault&lt;XElement&gt;();
  
          return result.Value;
      }
  }
  </code></pre>
  
  <p>Next, I create child class like the following code.</p>
  
  <pre><code>public class MainResource : ResourceBase
  {
      public static string AppName
      {
          return GetString("AppName");
      }
  }
  
  public class OtherResource : ResourceBase
  {
      public static string OtherName
      {
          return GetString("OtherName");
      }
  }
  </code></pre>
  
  <p>I have some problem because resource variable in base class. All child classes use some Resource variable. So, they always use same cached XDocument instance. Do you have any idea for fixing my sourcecode?</p>
  
  <p>PS. I found some Attribute like ContextStaticAttribute which indicates that the value of a static field is unique for a particular context. I think <strong>a particular context</strong> should be difference thread. So, I can't use it for solving this question.</p>
  
  <p><strong>Thanks,</strong></p>