gopal wrote:
Hi I am a newbie and i am trying to create a resource file (resx) for a
console C# application
Can i go to current C# project and add a new resource file and then
start adding values?
Can anyone please show a sample console application having a resource
file added like this.
Help would be appreciated
Regards
JK
Add a resource file via Project -Add New Item -Assembly Resource
File
Add items to your resource file.
Example code to get a resource with a "name" of "Res1" from a resource
file:
using System;
namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
System.Resources.ResourceManager rm = new
System.Resources.ResourceManager ("ConsoleApplication1.Resource1",
System.Reflection.Assembly.GetExecutingAssembly()) ;
Console.WriteLine (rm.GetString ("Res1"));
Console.ReadLine ();
}
}
}