problems with Resource File

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gopal

    problems with Resource File

    Hi,

    I had an issue with loading/using resource file. I thought i will share
    this information if it helpful some .

    I have a console C# application and inside this i have class definition
    as follows and my resource File name is

    Resource File - Resource1
    Namspace - EmployeeDetails
    Class - EmployeeDetails

    Default Namespace : Employee_Detail s [set by IDE] ???


    namespace EmployeeDetails
    {
    /*1.*/ public static ResourceManager m_ResourceManag er = new
    ResourceManager ("EmployeeDetai ls.Resource1",
    System.Reflecti on.Assembly.Get ExecutingAssemb ly());

    /*2.*/ public static System.Resource s.ResourceManag er resources = new
    System.Resource s.ResourceManag er(typeof(Emplo yeeDetails));

    class EmployeeDetails
    {
    static void Main()
    {
    Console.WriteLi ne(m_ResourceMa nager.GetString ("Name"));

    }
    }

    I had the following issue, when i specified the
    <Namespace.Reso urceNamefor the ResourceManager class object i was
    getting the error "the resouece name specified is not appropriate for
    the culture" and i was wondering what could be problem

    for the Namespace and class name were same. But to my astonishment, i
    opened the

    Project Properties and i could see the deafult namespace as
    "Employee_Detai ls" and not as
    EmployeeDetails . So i went to step 1 given above and changed the
    Namespace to

    Employee_Detail s.Resource and voila it worked

    You can also try this..Hope this is useful.

    Thanks
    Gopal

Working...