Posted By

faltumk on 02/08/07


Tagged

csharp ResourceFiles


Versions (?)

CSharp Reading String from Resource File .


 / Published in: C#
 

The resource file stores items as name-value pair. To get string values from the resource files (.resx) added in your project, use the following code.

  1. /*
  2. The resource file stores items as name-value pair.
  3.  
  4. To get string values from the resource files (.resx) added in your project, use the following code.
  5. */
  6.  
  7. //Name Spaces Required
  8. using System.Resources;
  9. using System.Reflection;
  10.  
  11. // Create the resource manager.
  12. Assembly assembly = this.GetType().Assembly;
  13.  
  14. //ResFile.Strings -> <Namespace>.<ResourceFileName i.e. Strings.resx>
  15. resman = new ResourceManager("StringResources.Strings", assembly);
  16.  
  17. // Load the value of string value for Client
  18. strClientName = resman.GetString("Client");

Report this snippet  

You need to login to post a comment.