How to read values from RESX file in ASP.NET using ResXResourceReader
Here is the method which returns the value for a particular key in a given resource file. Below method assumes resourceFileName is the resource filename and key is the string for which the value has to be retrieved. public static string ReadValueFromResourceFile(String resourceFileName, String key) { String _value = String.Empty; ResXResourceReader _resxReader = new ResXResourceReader( String.Format("{0}{1}\\{2}",System.AppDomain.CurrentDomain.BaseDirectory.ToString(), StringConstants.ResourceFolderName , resourceFileName)); foreach (DictionaryEntry _item in _resxReader) { if (_item.Key.Equals(key)) { _value = _item.Value.ToString(); break; } } return _value; }
span.fullpost {display:none;}