.net - Reading .resx files programmatically -
i have application contents of e-mails sent stored in .resx file.
asp.net application, .resx file lives in /app_globalresources
when need send e-mail, i'm reading using:
httpcontext.getglobalresourceobject("mailcontents", "emailid").tostring
now, need use same mailing method project (not website). mailing method in dll projects in solution share.
in other project, don't have httpcontext.
how can read these resources?
my current approach is, inside mailing class, check whether httpcontext.current null, , if so, use separate method.
separate method i'm looking @ right (after resigning myself fact there's nothing better) have path .resx file of website stored in app.config file, , somehow read file.
started trying system.resources.resourcereader, looks wants .resources file, not .resx one.
i think answered own question...
there's resxresourcereader class. couldn't find because it's in windows forms namespace, not included in current dll references.
unfortunately, let me iterate through results, i'll implement cute caching (read: memoization) on it...
Comments
Post a Comment