title: ResourceManager override GetResourceFileName
body: <p>I want to override a method in the System.Resources.ResourceManager class in mscorlib v4.</p>
  
  <p>I want to override the method GetResourceFileName like this;</p>
  
  <pre><code>    protected override string GetResourceFileName(CultureInfo culture) {
          string resourceFileName = base.GetResourceFileName(culture);
          return resourceFileName.Replace(".resources", ".resx");
      }
  </code></pre>
  
  <p>The problem is, to instanciate a ResourceManager class I must use the static method CreateFileBasedResourceManager, which returns a new instance of the ResourceManager. (because I need the file based resourcemanager)</p>
  
  <p>How can I override this method? I also tried to call the private constructor CreateFileBasedResourceManager calls to create the object, but i'm getting this exception (can't invoke private constructor with reflection?);</p>
  
  <pre><code>    [SecurityException: Request failed.]
    System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags) +0
     System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +323
     System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
     System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
     System.Xml.Xsl.XsltOld.FuncExtension.Invoke(XsltContext xsltContext, Object[] args, XPathNavigator docContext) +164
     MS.Internal.Xml.XPath.FunctionQuery.Evaluate(XPathNodeIterator nodeIterator) +430
  </code></pre>