C# Localization Application Example #Root #By Sayed Ahmed

The Resource File

# GreetingResources.txt 
# A resource file in text format for a "Hello World" application.
#
# Initial prompt to the user.
prompt=Enter your name: 
# Format string to display the result.
greeting=Hello, {0}!

--

Code to use the resource file

using System;
using System.Reflection;
using System.Resources;

public class Example
{
   public static void Main()
   {
      ResourceManager rm = new ResourceManager("GreetingResources", typeof(Example).Assembly);
      Console.Write(rm.GetString("prompt"));
      string name = Console.ReadLine();
      Console.WriteLine(rm.GetString("greeting"), name);                                                                          
   }
}
// The example displays output like the following:
// Enter your name: Wilberforce
// Hello, Wilberforce!

From: http://sitestree.com/?p=1317
Categories:Root, By Sayed Ahmed
Tags:
Post Data:2014-08-06 22:20:54

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada