Wednesday, August 13, 2008

Retrieve Value from Resource File using C#

// Here IPOhelper is the class name under which method with following implementation is defined. and file is the file path where resource filename (without extension) is located e.g. Namespace.FileName

string resourceValue = string.Empty;

ResourceManager resourceManager = new ResourceManager(file,typeof(IOHelper).Assembly);
resourceValue = resourceManager.GetString(key);
catch (Exception ex)
resourceValue = string.Empty;

No comments: