c# - ResourceManager override GetResourceFileName -
I want to override a method in the system Resources. Resource Manager class in Mscorlib v4.
I want to override the method like GetResourceFileName;
Protected override string GetResourceFileName (CultureInfo Culture) {string resourceFileName = base.GetResourceFileName (culture); Return resource filename Change (".resource", ".resx"); }
The problem is, to instanciate a resource manager class, I must use the CreateFileBasedResourceManager static method, which gives a new example of ResourceManager. (Because I need a file based resource manager)
How can I override this method? I also tried to call the personal creator CreateFileBasedResourceManager call to create an object, but I get this exception (can not use a personal constructor with reflection?); [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. Riflekshnkrentmeminfoinkonvok (object Obj, Baindingflag Invet Aetr, Binder binder, Object [] parameters, Kalcrinfo culture) +38 system. reflection. Methodbase Invov (object object, object [parameter] +35 system. Xml xsl.xsltOld.FuncExtension.Invoke (XsltContext xsltContext, Object [] args, XPathNavigator docContext) +164 MS.Internal.Xml.Xpath.FunctionQuery.Evaluate (XPathNodeIterator nodeitor) +430 E
Create your own resource provider and assign it to your app.config or web Context in .config. An example can be found
Comments
Post a Comment