Articles → .NET → Read Resource File In C#

Read Resource File In C#

What Is A Resource File?

How To Create Resource File In Visual Studio?

  1. Right click on the project and click on ‘Add New Item’
  2. From the General tab, select ‘Resource File’
  3. Picture showing adding the Resource File in the project
    Click to Enlarge

Adding Data In Resource File

Picture showing adding the data in the resource file
Click to Enlarge

Reading Resource File In C#

System.Resources.ResourceManager rm = new System.Resources.ResourceManager("Reading_resource_file.Resource1", System.Reflection.Assembly.GetExecutingAssembly());

  1. Project namespace is ‘Reading_resource_file’
  2. Folder name – As resource file is placed on the root folder of the project so we can ignore folder name.
  3. Resource – This is the file name of the resource file without extension.

Picture showing output of reading resource file in C#
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Tuesday, January 31, 2017


Your Email Id  
Query/FeedbackCharacters remaining 250